Last active
August 21, 2023 07:45
-
-
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
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
// 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 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah right, that's a thing! Can confirm it still works, thanks a lot!