DEV Community

loading...

How to Delete Tweets and Likes from Twitter

Vance Lucas
Lead Developer for Web, Mobile, API & Severless, Community Builder. Co-founder of Techlahoma Foundation, ThunderPlains, and OKC.js User Group.
Originally published at vancelucas.com on ・2 min read

I recently quit Twitter and deleted all my tweets and likes. This post shows how you can do the same.

Delete All Your Tweets

Start out by deleting all your tweets. You can use a 3rd party tweet delete tool to do this for you for free for up to 3200 tweets, and it’s quick and easy.

I think I had right around 3,100 or so tweets, so I was just under the free limit.

Delete All Your Likes

Deleting all your likes seems to be a lot more difficult than deleting all your tweets. I am not sure why, but a lot of tools don’t offer it as an option. It also appears to be rate-limited, so you may have to make multiple attempts at this over several days before you are able to unlike everything if you have lots of likes.

Go to your likes page: https://twitter.com/<username>/likes

Open up the Developer Tools console, and paste in the following script:

function _unlikeAll() {
  const randomNumber = (x, y) => ~~(Math.random() * y) + x;
  let unlikes = Array.from(document.querySelectorAll('[data-testid="unlike"]'));

  unlikes.forEach((unlikeEl) => {
    setTimeout(() => {
      unlikeEl.click();
    }, randomNumber(100, 8500));
  });

  window.scrollTo(0, document.body.scrollHeight);
}
var interval = setInterval(_unlikeAll, 12000);
Enter fullscreen mode Exit fullscreen mode

Let this run for a while. Use a tool like Caffieine to keep your computer awake while this is running if needed.

This script stopped a few times for me, so I had to re-run it over the course of a few days to get everything. Twitter seems to have some kind of rate-limiting built into their web API, so you may run into it also.

Cleanup

After authorizing apps to delete tweets for you (which requires full read and write access), make sure to head over to the authorized applications settings page on your Twitter account and revoke access to all the various apps you have used over the years.

Other Options

Here are a few more scripts and things I found when researching how to do this. Some of them worked, and some of them did not. If the above script is not working well for you, feel free to try a few others:

GitHub Gist: delete-likes-from-twitter.js: https://gist.github.com/aymericbeaumet/d1d6799a1b765c3c8bc0b675b1a1547d

GitHub Gist: delete-rt-and-tweets.js: https://gist.github.com/FocusWho/5a8e74895293eae0071cec612477c72f

Discussion (0)

Forem Open with the Forem app