Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Remove your Twitter likes
// 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
let favButton = tweetEl.querySelector('.js-actionFavorite');
favButton.click();
setTimeout(function() {
tweetEl.parentNode.removeChild(tweetEl);
}, 250);
}
function favThenRemove(tweetEl) {
// older tweets in your likes list may not show the favorited state correctly, so we click, then un-click.
// show it.
tweetEl.style.backgroundColor = 'rgba(0,255,0,0.5)';
// fav it.
let favButton = tweetEl.querySelector('.js-actionFavorite');
favButton.click();
setTimeout(function() {
removeTweet(tweetEl);
}, 450);
}
function removeFav() {
let tweetEl = document.querySelector('.js-actionable-tweet');
if(tweetEl) {
if(tweetEl.classList.contains('favorited')) {
removeTweet(tweetEl);
} else {
favThenRemove(tweetEl);
}
} else {
scrollToLoadMore();
}
}
let unfavInterval = setInterval(removeFav, 500);
@ChristianO0214

This comment has been minimized.

Copy link

ChristianO0214 commented Dec 11, 2018

How do I use this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.