Skip to content

Instantly share code, notes, and snippets.

@emnsen
Last active June 17, 2022 13:22
Show Gist options
  • Save emnsen/35d2bc2d5ff703241458f081941ba368 to your computer and use it in GitHub Desktop.
Save emnsen/35d2bc2d5ff703241458f081941ba368 to your computer and use it in GitHub Desktop.
Clean your tweets without app

Delete tweets and undo retweets

Step 1. 1

Step 2. 2

Step 3. 3

Step 4. Go to your Twitter profile: https://twitter.com/username and click the bookmark; you'll start to clean your tweets

ps: if you get a rate limit warning, wait for 15 min. and try again

javascript: (function() {
function deleteTweet() {
var tweet = document.querySelector('[data-testid="tweet"]');
var caret = tweet.querySelector('[data-testid="caret"]');
caret.click();
var deleteItem = document.querySelector('[role="menuitem"]');
if (!deleteItem) {
return;
}
if (deleteItem.textContent !== "Delete") {
document.querySelector('[role="menu"]').remove();
tweet.remove();
return;
}
deleteItem.click();
document.querySelector('[data-testid="confirmationSheetConfirm"]').click();
console.log("tweet deleted");
}
function undoRetweet() {
const rtButton = document.querySelector('[data-testid="unretweet"]');
if (!rtButton) return null;
rtButton.click();
document.querySelector('[data-testid="unretweetConfirm"]').click();
console.log("retweet deleted");
}
setInterval(() => {
undoRetweet();
deleteTweet();
}, 750);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment