Last active
June 16, 2026 09:40
-
-
Save cmj/6e6f6cae51c28cf6e161ceba8d108dda to your computer and use it in GitHub Desktop.
grab twitter guest tokens
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Grab Twitter guest account tokens for use with Nitter. | |
| # no longer working as of Jan 31, 2026 | |
| # https://api.twitter.com/1.1/guest/activate.json?skip_gt_rate_limit=true (param has no effect) | |
| guest_token=$(curl -s -XPOST https://api.twitter.com/1.1/guest/activate.json -H 'Authorization: Bearer AAAAAAAAAAAAAAAAAAAAAFXzAwAAAAAAMHCxpeSDG1gLNLghVe8d74hl6k4%3DRUMF4xAQLsbeBhTSRrCiQpJtxoGWeyHrDb5te2jpGskWDFW82F' -H 'Connection: close' | jq -r '.guest_token') | |
| flow_token=$(curl -s -XPOST 'https://api.twitter.com/1.1/onboarding/task.json?flow_name=welcome&api_version=1&known_device_token=&sim_country_code=us' \ | |
| -H 'Authorization: Bearer AAAAAAAAAAAAAAAAAAAAAFXzAwAAAAAAMHCxpeSDG1gLNLghVe8d74hl6k4%3DRUMF4xAQLsbeBhTSRrCiQpJtxoGWeyHrDb5te2jpGskWDFW82F' \ | |
| -H 'Content-Type: application/json' \ | |
| -H 'User-Agent: TwitterAndroid/10.21.1' \ | |
| -H "X-Guest-Token: ${guest_token}" \ | |
| -d '{"flow_token":null,"input_flow_data":{"flow_context":{"start_location":{"location":"splash_screen"}}}}' | jq -r .flow_token) | |
| curl -s -XPOST 'https://api.twitter.com/1.1/onboarding/task.json' \ | |
| -H 'Authorization: Bearer AAAAAAAAAAAAAAAAAAAAAFXzAwAAAAAAMHCxpeSDG1gLNLghVe8d74hl6k4%3DRUMF4xAQLsbeBhTSRrCiQpJtxoGWeyHrDb5te2jpGskWDFW82F' \ | |
| -H 'Content-Type: application/json' \ | |
| -H 'User-Agent: TwitterAndroid/10.21.1' \ | |
| -H "X-Guest-Token: ${guest_token}" \ | |
| -d "{\"flow_token\":\"${flow_token}\",\"subtask_inputs\":[{\"open_link\":{\"link\":\"next_link\"},\"subtask_id\":\"NextTaskOpenLink\"}]}" | | |
| jq -c -r '.subtasks[0]|if(.open_account) then {oauth_token: .open_account.oauth_token, oauth_token_secret: .open_account.oauth_token_secret} else empty end' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment