/** * 1. Go to "Likes" section of your profile (e.g. https://twitter.com/) * 2. Open browser Console (Cmd + Option + I on Mac, F12 otherwise?) * 3. Copy/Paste the script and press enter to run it. * * If your TwiX UI is not in French, make sure to update line 36 * (Change "Supprimer" to the label of the "Delete" menu item in your own language) * * At some point, depending on the number of items you need to process, you might see the following error in the console: * > "the server responded with a status of 429" * That's TwiX rate limiting. Reload the page, wait a few minutes/hours before trying again, and you should be fine. * Inspired from https://stackoverflow.com/a/72515907 */ function deleteTweetsRT() { console.log(document.querySelectorAll('[role="heading"]+div')[1].textContent); window.scrollBy(0, 10000); // Delete Retweets document.querySelectorAll('[data-testid="unretweet"]').forEach((item) => { item.click() document.querySelector('[data-testid="unretweetConfirm"]').click() }) // Delete Tweets document.querySelectorAll('[data-testid="caret"]').forEach((item, index) => { // I wanted to keep the last 3 tweets, so I added a minimum index. // Set the value to 0 to remove all of them const KEEP_LAST_N_TWEETS = 3 if (index >= KEEP_LAST_N_TWEETS) { item.click() // Menu apparently takes some time to appear. Let's wait a couple of milliseconds before // searching for the menuitem setTimeout(() => { const deleteBtn = document.querySelector('[data-testid="Dropdown"] [role="menuitem"]') // My TwiX is in French. You might want to change "Supprimer" to your own language if (deleteBtn?.textContent === 'Supprimer') { deleteBtn.click() document.querySelector('[data-testid="confirmationSheetDialog"] [data-testid="confirmationSheetConfirm"]')?.click() } else { document.body.click(); } }, 100) } }) setTimeout(deleteTweetsRT, 4000); //less than 4000 might be rate limited or account suspended. increase timeout if any suspend or rate limit happens } deleteTweetsRT()