Skip to content

Instantly share code, notes, and snippets.

@aymericbeaumet
Last active September 21, 2024 00: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)
@lionbytes
Copy link

Did Twitter send you a warning of some sort? @luisnomad

@luisnomad
Copy link

@lionbytes nope. I just noticed a sharp drop in engagement shortly after I mass "disliked" tweets. I never got an explanation, even though I explicitly asked support (publicly).

@maxime-paquin
Copy link

How do you turn this off? I reached the maximum number of API requests and now if I manually unlike, it automatically relikes.

@frankvei
Copy link

frankvei commented Feb 8, 2022

Thanks!

@EduardoReisDev
Copy link

Thanks!!

@erbanku
Copy link

erbanku commented Mar 21, 2022

Thanks!

@AtalaySezen
Copy link

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

setInterval 5000 did not work on me. If you have more than 2000 likes, like me. Try 10000 for setInterval, it worked.

Anyway, thanks!

@arshiardmhr
Copy link

I used this code, but after a few tweets, the rest of the tweets I liked were not shown to me, but others can see them.

@FranciscoMoretti
Copy link

The code from the last comment worked for me 👍

@catielkerr
Copy link

I used this code, but after a few tweets, the rest of the tweets I liked were not shown to me, but others can see them.

I had the same issue

@iMaz1n
Copy link

iMaz1n commented May 16, 2022

@jeremiah-k
Copy link

I used the specified codes and 6700 likes do not appear when I enter my profile. But when I enter my own profile from someone else's account, the likes appear. Has anyone else experienced this situation?

Yep. Same.

@311298
Copy link

311298 commented Jun 1, 2022

works fine - 2022 may https://stackoverflow.com/a/71333246/6798139

It started un following person whom I follow

@311298
Copy link

311298 commented Jun 1, 2022

can anyone share me the latest code to unlike the tweets , because I tried all above solution still getting errors.
thanks in advance

@0xfoobar
Copy link

Had to add greater timeouts between liking and unliking

setInterval(async () => {
  for (const d of document.querySelectorAll('div[data-testid="like"]')) {
     d.click()
  }

  await new Promise(r => setTimeout(r, 5000));

  for (const e of document.querySelectorAll('div[data-testid="unlike"]')) {
    e.click()
  }
 
  window.scrollTo(0, document.body.scrollHeight)
}, 20000)

@Alex39-bot
Copy link

How do I turn the code off???

@knedl1k
Copy link

knedl1k commented Jun 23, 2022

How do I turn the code off???

Just refresh the page, F5.

@WizardOfOoo
Copy link

I combined some of the above to make this:
Was slow, and didn't have much action on the screen, but it worked.
Chrome / Win 10

setInterval(() => {
for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
d.click()
}
window.scrollTo(0, window.pageYOffset+300)
}, 10000)

@dcole819
Copy link

dcole819 commented Aug 1, 2022

How do I remove the code??? My Twitter has been acting up since I did this I want it back to normal please help

@kyllian-vssr
Copy link

Working nice today.

@dcole819
Copy link

dcole819 commented Aug 3, 2022

It’s unliking things but it still shows up in my likes just without the heart…anyway to remove the code???

@partsp
Copy link

partsp commented Aug 10, 2022

still can't get it to work. it deletes the tweets but then they come back

@nonononono9
Copy link

Works for a bit and then stops, most likely because of the API but then everything it unfavorites comes back. Which 100% defeats the purpose of this.

@kyllian-vssr
Copy link

kyllian-vssr commented Aug 15, 2022

It’s unliking things but it still shows up in my likes just without the heart…anyway to remove the code???

@dcole819, CTRL+F5 or MAJ+F5 to stop the scripts correctly.

Sometime the API will block you for some minutes or hours if you have mass likes to "remove". 😁

still can't get it to work. it deletes the tweets but then they come back

@partsp same here, just got blocked by API because of too much tweet. retry later. ^^

@MBUMILA
Copy link

MBUMILA commented Sep 4, 2022

It worked! thanks

Copy link

ghost commented Sep 11, 2022

I'm not so good with Javascript - does anyone know how to modify this to unlike Tweets which contain a certain phrase?- eg only unlike Tweets containing the phrase 'boiled eggs'.

@dystorwell
Copy link

dystorwell commented Sep 26, 2022

hello there.
I don't know why but it doesn't work. here's a screenshot of the error.
it worked for a hundred of likes and then stopped.
keep in mind I don't know anything about java.
have a good day :)

Schermata 2022-09-26 alle 21 18 17

edit. worked, then all my likes came back, including the ones I unliked before using this...

@ChitranshuV
Copy link

ChitranshuV commented Oct 12, 2022

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

setInterval 5000 did not work on me. If you have more than 2000 likes, like me. Try 10000 for setInterval, it worked.

Anyway, thanks!

Working for me as of 12th Oct 2022. The only issue is that it starts throwing errors like api/graphql after some time. I take 5 mins break and restart it and it works great. There is rate limit of 900 requests every 15 minutes. https://developer.twitter.com/en/docs/twitter-api/rate-limits

Is there any code similarly for deleting tweets&repllies ??

@Kirytah
Copy link

Kirytah commented Oct 16, 2022

I haven't found any. If you find one please let me know.

@mscdo
Copy link

mscdo commented Nov 11, 2022

It worked for a moment, but as others said, the tweets come back. Still finding an answer to that.

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