Skip to content

Instantly share code, notes, and snippets.

@LaruYan
Last active March 14, 2023 18:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LaruYan/8090c59ee6012b436be8d063b45bfe75 to your computer and use it in GitHub Desktop.
Save LaruYan/8090c59ee6012b436be8d063b45bfe75 to your computer and use it in GitHub Desktop.
Unfavourite Tweet button clicker (scrolls through and unlike/unfavourite tweets from your own likes/favourites only)
var unfavTweetsTimer = null;
var doUnfavTweetsFn = () => {
clearInterval(unfavTweetsTimer);
Array.from(document.querySelectorAll('article[data-testid="tweet"] div[data-testid="unlike"]'))
.forEach(unlikeBtn => {
unlikeBtn.click();
})
window.scrollTo({
top: document.body.scrollHeight,
left: 0,
behavior: 'auto'
});
unfavTweetsTimer = setInterval(doUnfavTweetsFn, 500);
};
unfavTweetsTimer = setInterval(doUnfavTweetsFn, 16);
@LaruYan
Copy link
Author

LaruYan commented Aug 22, 2022

DESIGNED TO RUN THIS ON YOUR LIKES PAGE

"Likes" page on address bar looks like

twitter.com/(your_twitter_username)/likes

@LaruYan
Copy link
Author

LaruYan commented Aug 22, 2022

For faster processing, I recommend a rule for uBlock Origin. this prevents images on each tweet from loading

add this in "My Filters" Tab on uBlock Origin's settings page.

twitter.com##section > div figure

don't forget to remove this after done unliking :)

@LaruYan
Copy link
Author

LaruYan commented Aug 23, 2022

fixed a selector error tweetEntries.queryselectorAll is not a function

@clippyspeaks
Copy link

Thanks, this is one of the better scripts I've found for this. Still working as of 3/14/23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment