Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save DaggieBlanqx/679fed3e1162701bdf547a65e9d91c28 to your computer and use it in GitHub Desktop.

Select an option

Save DaggieBlanqx/679fed3e1162701bdf547a65e9d91c28 to your computer and use it in GitHub Desktop.
With this script, you can remove all tweets you are tweeted on Twitter. Don't forget add your nickname to line 9. (The script begins 60 seconds after pasting the code.)
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 === '@{YOUR_TWITTER_NICKNAME}'); // --> e.g. '@twitter'
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(250);
// Click delete button
document.querySelector('.r-9l7dzd.r-4qtqp9.r-yyyyoo.r-1q142lx.r-1xvli5t.r-1rq6c10.r-dnmrzs.r-bnwqim.r-1plcrui.r-lrvibr').parentElement.parentElement.click();
await timer(250);
// Click confirm button
document.querySelector('div[data-testid="confirmationSheetConfirm"]').click();
await timer(250);
}
await window.scrollTo(0, document.body.scrollHeight);
}, 60000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment