Skip to content

Instantly share code, notes, and snippets.

@cacheflowe
Last active January 27, 2024 13:29
Show Gist options
  • Star 25 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save cacheflowe/6c26bb757d934e2e6c68c9287148af58 to your computer and use it in GitHub Desktop.
Save cacheflowe/6c26bb757d934e2e6c68c9287148af58 to your computer and use it in GitHub Desktop.
Remove your Twitter likes
// [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);
@ChristianO0214
Copy link

How do I use this?

@BerkUsta
Copy link

Works excellent, thank you.

@erainey
Copy link

erainey commented Dec 7, 2022

Thanks for sharing this. Still works as of 12/7/22!

@onura46
Copy link

onura46 commented Jan 25, 2023

Seemed to do the trick for me at time of posting!

@wadewegner
Copy link

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.

@cacheflowe
Copy link
Author

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