Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save helloromero/6a9f8c9e015cddf16c343ec4326fb230 to your computer and use it in GitHub Desktop.
Save helloromero/6a9f8c9e015cddf16c343ec4326fb230 to your computer and use it in GitHub Desktop.
how to delete your tweets just using your browser, no oauth required
// 1. go to your twitter feed with tweets and replies
// for example, mine was twitter.com/6a68/with_replies
// 2. scroll all the way down to the bottom of the page.
// I suppose you could automate this with JS, but I didn't.
// this function will delete tweets you can delete, i.e. not retweets:
function deleteTweets() {
// find the next delete button in the DOM (next deletable tweet)
// and click the delete button. I wanted to keep the first tweet,
// which is why the index here is 1.
if (!$('.js-actionDelete').length) {
return console.log('all done deleting');
}
$('.js-actionDelete')[1].click();
// click the button to confirm the deletion
$('.delete-action').click();
// do it again
setTimeout(deleteTweets, 1000);
}
// next, we want to unretweet the retweets. probably good to reload the page
// before running this one.
function unretweet() {
els = $('.is-retweeted .js-actionRetweet');
for (var i = 0; i < els.length; i++) {
if (els[i].classList.contains('ProfileTweet-actionButtonUndo')) {
els[i].click()
}
}
}
unretweet();
// next, go to the favorites page.
// scroll to the bottom to load 'em all.
function whatever() {
els = $('.is-favorited .js-actionFavorite');
for (var i = 0; i < els.length; i++) {
if (els[i].classList.contains('ProfileTweet-actionButtonUndo')) {
els[i].click()
}
}
}
whatever();
// unfollowing too? yeah?
// yeah. let's do it.
// open the following page, croll to the bottom, and do it:
function unfollow() {
// doing .each seems to freak out the DOM, so use setTimeout(0).
$('.following button.follow-button')[0].click();
setTimeout(unfollow)
}
unfollow();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment