Skip to content

Instantly share code, notes, and snippets.

Embed
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: 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)
@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.

@WizardOfOoo
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!

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 ??

https://tweetdelete.net/

@lionbytes
Copy link

lionbytes commented Nov 13, 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 ??

I modified the code a while ago. It worked for me, you just need to run it and go do something while it deletes the tweets:
https://gist.github.com/lionbytes/2e8ad01d0ec318354aa5e95b746c7e54

@osmanbowser
Copy link

Works on Chrome! Thanks!

@chriiisclm
Copy link

chriiisclm commented Nov 18, 2022

nice still works on chrome, tab should be open tho.

@qoqnus13
Copy link

Hi,
How can I limit this code to a time period or a username? I don't want all likes to be removed and only want to remove the likes of a particular account

@dafunks
Copy link

dafunks commented Nov 28, 2022

Just so you all know, if you use GreaseMonkey you can easily do this with a script:
https://stackoverflow.com/questions/64863099/deleting-tweets-with-js-console/71333246#71333246 and it works really well.

@bpawel-bclub
Copy link

bpawel-bclub commented Dec 15, 2022

Would anyone please share the latest snippet? (15 Dec 2022 doesn't seem to be deleting likes...) - Thank you!
EDIT (18/12/22): The script might actually be working: it removes the "hearts" but the liked tweets still stay in place, so I was a bit confused.

@briocon7
Copy link

I have 13 likes on my account that i can't get rid of. I also can't see them. I assume these likes are from suspended twitter accounts. But i don't know for sure. I tried running the code but it didn't change anything. Any idea how to get rid of those invisible likes?

@plambrechtsen
Copy link

FYI for anyone who happens across this gist, there is a limit of 1000 likes / unlikes per day and older liked tweets don't show up as "liked" on your timeline, so you need to like and unlike them to actually remove them.
I am using semiphemeral to remove the likes and retweets.
As per https://github.com/micahflee/semiphemeral#deleting-old-likes

@bobmagicii
Copy link

bobmagicii commented Dec 30, 2022

the OG post is still working for me on the 30th of dec 2022. doing it in batches of 900 due to the rate limit.

i think a lot of people seeing it not work are seeing cache. the current iteration of their site uses stupid amounts of local cache in addition to server side stuff. a hard refresh (shift+refresh) usually clears it. also deleting my tweets with another script, my counter still says 41 even though there are 1. and yesterday it still said 83. so that was more of their server side cache i think and maybe a week from now it'll be a different lower number.

also i think if you posted in "communities" those count as posts but are not searchable by anything on their system. i was semi active in the php community and there seems to be no way to even manually find those posts to hand delete.

if you're rooting around the dev console to use this you can kinda see how absolutely bad their app is. cors violations for days lmao.

another final note if you do hit the api rate limit, and hit it too hard, the rest of the ui will take a dump. if you hit the like delete rate limit and refresh there is a chance it will say you still have 300 likes, but "you dont have any likes yet" for a while, because the api just so angry. that only happened once so far though. it can also happen if you've blocked accounts. you'll have to unblock and unmute them.

@7jmoran
Copy link

7jmoran commented Jan 5, 2023

Screen Shot 2023-01-04 at 10 55 00 PM

Hello!

I hope those who see this are having a great week. I used the script to mass delete likes, and it was working well until it broke. I guess I did it too quickly and reached the limit. If anyone, absolutely anyone, can help me figure out how to fix this so that my likes will reappear so that I can continue deleting likes (carefully this time), I will be eternally grateful. Please. I am desperate. I am afraid that I have ruined Twitter forever. As you can see, it says that I have not liked anything yet, but I have over 5K likes.

Thank you!

@Jsdfngjkds
Copy link

i have the same problem, the no. of tweets is 300 but it says on the likes tab You don’t have any likes yet
. ANY HELP?

@bobmagicii
Copy link

bobmagicii commented Jan 8, 2023

every weekend i have to go back to twitter and more likes are there. its almost like it takes their system forever to dig them out of super old archive. and if i unlike like 20 of them, while still staring at more and refresh all of them will vanish. until next weekend again. im down to 291 now.

you just have to keep on keeping on.

@ShitaraRimule
Copy link

ShitaraRimule commented Jan 18, 2023

by favorite, you mean bookmarks yes or no ? thats can be usefull for myself if yes.

@jbreckmckye
Copy link

It's hard to say what the deal is with Twitter right now. Since the takeover it seems increasingly unstable. A lot of non-core things are apparently silently broken

@gomexreal
Copy link

thankyou sir :) worked your all script ,

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