Last active
May 7, 2025 05:30
-
-
Save farzany/7b36a1f3e719091a79ba508974c9be27 to your computer and use it in GitHub Desktop.
Twitter (π) Script: Unlike all liked Tweets
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
| async function wait(count) { | |
| const timeout = count % 50 === 0 ? 30000 : Math.random() * 1000 + 2000; | |
| await new Promise(resolve => setTimeout(resolve, timeout)); | |
| } | |
| async function unlikeAllTweets({ limit, deleteTweets=false }) { | |
| let count = 0; | |
| while (count < limit) { | |
| const unlikeButton = document.querySelector('[data-testid="unlike"]'); | |
| if (!unlikeButton) break; | |
| if (!deleteTweets) { | |
| unlikeButton.focus(); | |
| } | |
| unlikeButton.click(); | |
| const tweet = unlikeButton.closest('[data-testid="tweet"]'); | |
| const author = tweet?.querySelector('[data-testid="User-Name"]')?.textContent?.split('@')[0] || 'User'; | |
| console.log(`Unliked Tweet #${++count} by ${author}`); | |
| await wait(count); | |
| if (deleteTweets) { | |
| tweet.closest('[data-testid="cellInnerDiv"]').remove(); | |
| } | |
| } | |
| console.log(`Done! Unliked ${count} tweets.`); | |
| } | |
| unlikeAllTweets({ limit: 50, deleteTweets: true }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thx