Skip to content

Instantly share code, notes, and snippets.

View igorbrigadir's full-sized avatar

Igor Brigadir igorbrigadir

View GitHub Profile
#!/bin/bash
#
# the first 100, anyways
#
curl -s -H "Authorization: Bearer $(curl -s -X POST -H "Content-Type: application/json" -d '{"identifier": "me.bsky.social", "password": "letmein"}' "https://bsky.social/xrpc/com.atproto.server.createSession" | jq -j ".accessJwt")" "https://bsky.social/xrpc/app.bsky.graph.getMutes?limit=100" | jq -r '.mutes | .[] | .did' | xargs -I{} -P10 curl -s 'https://plc.directory/{}' | jq -r '.alsoKnownAs[0]' | sed -e 's#at://#@#' | sort
@igorbrigadir
igorbrigadir / BookmarkAPI_en.md
Created August 3, 2020 12:46 — forked from stepney141/BookmarkAPI_en.md
WIP: Twitter Undocumented Endpoints for Bookmark

Twitter Undocumented Bookmark API (WIP)

I found out the endpoints for bookmark with Chrome Developer Tools: GET timeline/bookmark, POST bookmark/entries/remove, POST bookmark/entries/remove. The rate limits below are values returned by an official endpoint GET application/rate_limit_status.

This document is still a work in progress because I got stuck in GET timeline/bookmark. Please let me know if you find how to use it.

Notes

  • It is necessary that x-csrf-token in a request header and ct0 in a cookie are the same value. Twitter uses them to avoid CSRF attacks. I recommend that you extract the values from your browsers.
  • All of the endpoints requires OAuth2 Authorizations. Note that they refuse OAuth2 Bearer tokens obtained from POST oauth2/token.
  • You can easily reach the rate limit and get HTTP 429 Error (too many requests), so you should be careful about how many requests you send.
@igorbrigadir
igorbrigadir / anandwrite_twitter_survey_replies.R
Created April 12, 2019 14:51 — forked from yonicd/anandwrite_twitter_survey_replies.R
code to retrieve @AnandWrites adhoc survey replies
library(magrittr)
library(rtweet)
root_status <- '1116361675618361345'
x1 <- rtweet::lookup_tweets(root_status)
# The question
cat(x1$text)
#> Who do you:
@igorbrigadir
igorbrigadir / get_tweet_replies.py
Created February 26, 2019 19:35 — forked from qqpann/get_tweet_replies.py
[Get Tweet Replies] Get Tweet Replies with Twitter API #twitter #python #tweepy
# Author: Qiushi Pan (@qqhann)
# This is a code snippet with sample usage, to get replies to a specific tweet.
# =====
import tweepy
import time
import os
from collections import defaultdict
from dotenv import load_dotenv, find_dotenv
env = load_dotenv(find_dotenv(), override=True)
# List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
# Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
# Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(valuelist)]