Last active
January 27, 2024 13:29
-
-
Save cacheflowe/6c26bb757d934e2e6c68c9287148af58 to your computer and use it in GitHub Desktop.
Remove your Twitter likes
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
// [Noted in the comments below on 2023-10 - this script might not work very well anymore due to Elon ruining Twitter] | |
// [Updated 2021-01-18 w/new selectors] | |
// go to your account Likes page and run this in the console: | |
function scrollToLoadMore() { | |
// keep scrolling if twitter tries to stop loading more. | |
// scroll up, then down to force infinite load. | |
window.scrollTo(0, 0); | |
setTimeout(function() { | |
window.scrollBy(0, 9999999999); | |
}, 200); | |
} | |
function removeTweet(tweetEl) { | |
// show it | |
tweetEl.style.backgroundColor = 'rgba(255,0,0,0.5)'; | |
tweetEl.scrollIntoView(); | |
window.scrollBy(0, -150); | |
// remove it | |
setTimeout(function() { | |
tweetEl.parentNode.removeChild(tweetEl); | |
}, 750); | |
} | |
function removeFav() { | |
let buttonEl = document.querySelector('[data-testid="unlike"]'); | |
if(buttonEl) { | |
let tweetEl = buttonEl.closest('article'); | |
if(tweetEl) { | |
buttonEl.click(); | |
removeTweet(tweetEl); | |
} | |
} else { | |
console.log('No Tweets found'); | |
scrollToLoadMore(); | |
} | |
} | |
let unfavInterval = setInterval(removeFav, 1500); |
Seemed to do the trick for me at time of posting!
Twitter must have set more aggressive limits, as I very quickly got a 429, and it looks like it will take more than 24 hours to refresh. It makes this pretty useless, given the 10s of thousands of likes I want to remove.
Thanks for the heads up @wadewegner. I'm not surprised, given how much things have degraded over there. There were limits before now - I wanted to wipe all of my likes, but the site wouldn't load likes past a certain point, so I couldn't get to the last ~9,000 of my own.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing this. Still works as of 12/7/22!