-
-
Save qdilmac/4690ca38bf22ea1fe837d8f048b86c99 to your computer and use it in GitHub Desktop.
Remove your Twitter likes
This file contains 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
// [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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment