Skip to content

Instantly share code, notes, and snippets.

@Arturro43
Created October 24, 2023 01:46
Show Gist options
  • Save Arturro43/6b8e81d77aef9a0f3945eb351bf571a2 to your computer and use it in GitHub Desktop.
Save Arturro43/6b8e81d77aef9a0f3945eb351bf571a2 to your computer and use it in GitHub Desktop.
X-twitterminate - remove all of your Twitter tweets (posts), retweets (reposts) and comments. Basically clean up your account.
(function () {
var delTweets = function () {
var tweetsRemaining = document.querySelectorAll('[role="heading"]+div')[1].textContent;
console.log("Remaining: ", tweetsRemaining);
window.scrollBy(0, 10000);
var moreButtons = document.querySelectorAll('[aria-label="More"]');
var deleteButtons = document.querySelectorAll('span:contains("Delete")');
var confirmationButtons = document.querySelectorAll('[data-testid="confirmationSheetConfirm"]');
var unretweetButtons = document.querySelectorAll('[data-testid="unretweet"]');
var unretweetConfirmButtons = document.querySelectorAll('[data-testid="unretweetConfirm"]');
moreButtons.forEach(function (button, index, array) {
button.click();
deleteButtons[index].click();
confirmationButtons[index].click();
});
unretweetButtons.forEach(function (button, index, array) {
button.click();
unretweetConfirmButtons[index].click();
});
setTimeout(delTweets, 0);
};
delTweets();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment