Skip to content

Instantly share code, notes, and snippets.

@michaelnordmeyer
Last active August 21, 2023 07:45
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 michaelnordmeyer/10aa5b46ecf3f24a779ef0d440a854cd to your computer and use it in GitHub Desktop.
Save michaelnordmeyer/10aa5b46ecf3f24a779ef0d440a854cd to your computer and use it in GitHub Desktop.
Deletes all your Twitter retweets when being on your profile page twitter.com/<username> as of early 2022
// Deletes all your Twitter retweets when being on your profile page twitter.com/<username>
// Barebones script: runs every second, unretweets the topmost retweet, scrolls to the bottom if no more retweets on page
// It won't stop unless manually reloading the page removes this code. Tested with Twitter web May 2022
setInterval(
function() {
console.log('Searching for unretweet UI...');
var menu = document.querySelectorAll('[data-testid=unretweet]')[0]; // find unretweet menu
if (menu === undefined) {
console.log('No unretweet menus found. Scrolling to load more tweets...');
window.scrollTo(0, document.documentElement.scrollHeight); // scroll to bottom of page to load more
} else {
console.log('Found menu...');
menu.scrollIntoView();
menu.click();
var button = document.querySelectorAll('[data-testid=unretweetConfirm]')[0]; // find confirmation buttons
if (button === undefined) {
console.log('No unretweet button found');
} else {
console.log('Found unretweet button. Clicking...');
button.click();
console.log('Unretweeted');
}
}
}, 1000
)
@le-jun
Copy link

le-jun commented Aug 20, 2023

I'm curious, how do you use such code (Should I download a browser extension for JS scripts)? Does it still works? Can it be extended to support faves? I want to nuke every interaction from my account.

@michaelnordmeyer
Copy link
Author

To use it, you paste it into the browser's developer console. It will start my itself and has to be stopped by reloading the page. I don't know if it still works, because I don't have anything left to delete in my Twitter account. To delete faves, there's another script: https://gist.github.com/michaelnordmeyer/bf4a8dc038b0c5092d474aabf1573dac

@le-jun
Copy link

le-jun commented Aug 21, 2023

Ah right, that's a thing! Can confirm it still works, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment