Last active
October 1, 2024 15:18
-
-
Save jaredhirsch/c9be82b168c5c823b407 to your computer and use it in GitHub Desktop.
how to delete your tweets just using your browser, no oauth required
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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