Last active
March 30, 2025 18:51
-
-
Save twilight-sparkle-irl/6040275212f8822e48ef535459c97d44 to your computer and use it in GitHub Desktop.
pin retweets on twitter ----> ----> !! YOU NEED TO BE ON THE OLD LAYOUT, GET GoodTwitter !! <---- <----
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
$(document).ajaxComplete((e, x, o) => { | |
if (o.url == "https://api.twitter.com/1.1/statuses/retweet.json") { | |
tweet_id = JSON.parse(x.responseText)['id_str']; | |
auth_token = JSON.parse(document.querySelector('#init-data').value)['formAuthenticityToken']; | |
fetch("https://twitter.com/i/tweet/pin", { | |
body: `authenticity_token=${auth_token}&id=${tweet_id}`, | |
method: "POST", | |
headers: { | |
Accept: "application/json, text/javascript, */*; q=0.01", | |
"Cache-Control": "no-cache", | |
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", | |
"X-Requested-With": "XMLHttpRequest", | |
"X-Twitter-Active-User": "yes" | |
} | |
}).then(res => res.json()).then(res => $(document).trigger('uiShowError', res)) | |
} | |
}) | |
// paste this into javascript console on a twitter permalink status page (https://twitter.com/[user]/status/[id]) | |
// this will make any tweet you retweet on that page also pin itself to your profile | |
// this is very laggy bc jquery sucks | |
// so i recommend opening your tweet in a new tab, pasting the code, retweeting, and then closing the tab | |
// also this only works on old twitter, not nu PWA twitter | |
// enjoi | |
// oh also | |
// this works because when you retweet a tweet, you get a tweet id | |
// this is not the original tweet's id, this is actually the id *of your retweet* | |
// for backwards compatibility reasons, twitter, despite displaying them differently, actually has retweets stored as normal tweets | |
// and these normal tweets are attributed to you | |
// so since it's a tweet, and it's attributed to you, the /i/tweet/pin api goes "well ok" and pins it bc it never checks if its a retweet |
@sks316 Requires ability to sign requests using oauth, cannot currently figure out obvious way to do this.
Until then, get Twitter oauth keys with R/W access, grab retweet ID (can be done using network inspector), and then run this using twurl:
twurl -d "tweet_mode=extended&id=[retweet ID]" /1.1/account/pin_tweet.json
I think Twitter killed the loophole for account/pin_tweet
when they released v2, trying to get it to pin a retweet status now gets a 404 with 'errors':[{'code': 144, 'message': 'No status found with that ID.'}]
as the body even using v1.1.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Old layout is discontinued, consider porting this to the new layout