Skip to content

Instantly share code, notes, and snippets.

@mattkenefick
Created December 2, 2025 18:05
Show Gist options
  • Select an option

  • Save mattkenefick/ab108824a5da9c050875fbf64c40d457 to your computer and use it in GitHub Desktop.

Select an option

Save mattkenefick/ab108824a5da9c050875fbf64c40d457 to your computer and use it in GitHub Desktop.
Delete your tweets
/**
* Not the most efficient way of doing it, but better than paying for a service.
* This will hit rate limits, so you'll have to do it more than once.
*
* Username would be your name as seen in an individual tweet.
*/
async function deleteTweet() {
const username = 'abc efg';
let tweets = [...document.querySelectorAll('article')].filter((tweet) => tweet.innerText.includes(username));
if (!tweets || tweets.length === 0) {
window.scrollTo({
top: document.documentElement.scrollHeight,
behavior: 'auto',
});
}
// Open menu
tweets[0].querySelector('button[aria-haspopup="menu"]').click();
// Start delete
setTimeout(() => document.querySelector('div[role=menuitem]').click(), 100);
// Delete
setTimeout(() => document.querySelector('button[data-testid="confirmationSheetConfirm"]').click(), 200);
}
setInterval(() => deleteTweet(), 500);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment