Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
[Recipe] Delete all your likes/favorites from Twitter

Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.

  1. Go to:{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
  window.scrollTo(0, document.body.scrollHeight)
}, 1000)
Copy link

I am aware that this is turning into the programmer's version of playing Stairway to Heaven.
But here's mine

  • rather than estimating a scroll offset, it simply uses focus() to scroll the next item into view
  • has a backoff every 50 unlikes to prevent HTTP 429: Too Many Requests
function nextUnlike() {
  return document.querySelector('[data-testid="unlike"]')

function wait(ms) {
  return new Promise(resolve => setTimeout(resolve, ms))

async function removeAll() {
  let count = 0
  let next = nextUnlike()
  while (next) {
    console.log(`Unliked ${++count} tweets`)
    await wait(count % 50 === 0 ? 30000 : 2000)
    next = nextUnlike()
  console.log('Out of unlikes, count =', count)


At time of writing this is printing Unliked 1506 tweets

This works wonderfully. Thank you @jbreckmckye

It is not working either

main.2b1c61fa.js:1 POST 429

it logs "x tweets removed" but in reality nothing changes.

Copy link

@limeraiin You may need to increase the timeout. Wait a day or so as well, so you aren't on any LB blacklists.

A more complicated script could try and intercept the fetch call and back off on a 429. Assuming the calling script doesn't have a handle on it via a closure. The thing is though, by the time you're getting that error, you're already being rate limited.

It's also possible twitter are clamping down further on rate issues due to problems on their platform. It's a bit inexact.

Copy link

Any idea how to unretweet a tweet If you’re blocked? I read this...
And have the tweetID...possible to modify one of the above scripts and use the ID and unretweet it in the console?

Copy link

nicoh88 commented Apr 18, 2023

Hello, can the script be tapped so that only likes older than 30 days are removed? Would be great!

And maybe the whole thing for retweets too?


Copy link

Funcionó hasta cierto punto, porque, al igual que otros, me apacen likes invisibles que no se dejaron borrar. ¡Muchas gracias!

Copy link

sunnycs121 commented May 17, 2023

I thought it was working until i refreshed the likes page, all likes were there and now I cannot even unlike manually. I f i try to manually unlike any post it automatically likes it again. Long story short now my likes are permanent forever. 👎

Copy link


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