Forked from antlionguard/twitter-remove-tweets.js
Last active
September 6, 2023 15:40
-
-
Save julianhofmann/509f5ee6681ad30fb09d11ccdb08f888 to your computer and use it in GitHub Desktop.
With this script, you can remove tweets you have tweeted on Twitter. Has been running in search for "(from:{YOUR_TWITTER_NICKNAME}) until:2022-09-01" on 2023-09-06. Don't forget add your nickname to line 9. (The script begins 60 seconds after pasting the code.)
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
const timer = ms => new Promise(res => setTimeout(res, ms)); | |
setInterval(async () => | |
{ | |
// Get all tweets | |
const allTweets = document.querySelectorAll('.css-1dbjc4n.r-18u37iz.r-1wbh5a2.r-13hce6t'); | |
// Filter tweets | |
const filteredTweets = Array.prototype.slice.call(allTweets).filter(x => x.innerText.startsWith('@{YOUR_TWITTER_NICKNAME}')); | |
for (const tweet of filteredTweets) { | |
tweet.scrollIntoView(); | |
// Click three dot and open action menu | |
tweet.parentElement.parentElement.parentElement.parentElement.parentElement.querySelector('div[data-testid="caret"]').click(); | |
await timer(150); | |
// Click delete button | |
document.querySelector('.css-1dbjc4n.r-1loqt21.r-18u37iz.r-1ny4l3l.r-1j3t67a.r-kmv1fd.r-o7ynqc.r-6416eg.r-13qz1uu').click(); | |
await timer(250); | |
document.querySelector('div[data-testid="confirmationSheetConfirm"]').click(); | |
await timer(250); | |
} | |
await window.scrollTo(0, document.body.scrollHeight); | |
console.log('Finished this run') | |
}, 60000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment