Skip to content

Instantly share code, notes, and snippets.

@aymericbeaumet
Last active April 14, 2025 05:39
Show Gist options
  • Save aymericbeaumet/d1d6799a1b765c3c8bc0b675b1a1547d to your computer and use it in GitHub Desktop.
Save aymericbeaumet/d1d6799a1b765c3c8bc0b675b1a1547d to your computer and use it in GitHub Desktop.
[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: https://twitter.com/{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
    d.click()
  }
  window.scrollTo(0, document.body.scrollHeight)
}, 1000)
@tahakara
Copy link

I think the fastest way is to block the CDN domains that I will provide in the Ublock Origin > My FILTERS section and then use the script below with an interval of 600 ms because the current rate limit is 500 req/5min, so 600ms is suitable for this situation.

CDN domains

abs-0.twimg.com/*
video.twimg.com/*
pbs.twimg.com/*

(Don't forget to delete the filters afterwards.)

setInterval(() => {
  const d = document.querySelector('div[data-testid="unlike"]')
  if(d) {
    d.click()
  } else {
    window.scrollTo(0, document.body.scrollHeight)
  }
}, 1000)

@btywoniuk
Copy link

setInterval(() => {
  for (const d of document.querySelectorAll('button[data-testid="unlike"]')) {
    d.click()
  }
  window.scrollTo(0, document.body.scrollHeight)
}, 1000)

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