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)
@GarlandKey
Copy link

GarlandKey commented Aug 22, 2021

To everyone getting the errors, you need to change the interval time at the end of the script. I changed it from 1000 milliseconds to 5000 and it worked fine.

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

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

@alysaeedy
Copy link

alysaeedy commented Aug 23, 2021

It works. Thanks.
But its really slow.
Is there any solution for that?

@ishehraj
Copy link

ishehraj commented Aug 29, 2021

slow is better. It'll not spice up Twitter bot again n' again

@tosho
Copy link

tosho commented Aug 31, 2021

Any way the script from the first Likes not the last ones?
Can you reverse the order of the Likes so you can start with the oldest ?

@tosho
Copy link

tosho commented Sep 1, 2021

To everyone getting the errors, you need to change the interval time at the end of the script. I changed it from 1000 milliseconds to 5000 and it worked fine.

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

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

I still get the POST 429 error after certain 'un-likes'.
Even 'un-liking' by hand after certain time stops working.
I'm interested how to reverse the 'likes' so I can see the oldest ones and 'un-like' by hand.

@gabscdb
Copy link

gabscdb commented Oct 29, 2021

Help, the unliked tweets keep showing on my profile, and on the Liked Tweets counter. They appear without the red heart, as if I hadn't liked them. They have been there for a couple weeks now, after using this code

@lionbytes
Copy link

lionbytes commented Nov 13, 2021

For those who are being blocked by Twitter's API from achieving what this code does, I give you a slower version that is more API-friendly:

setInterval(() => {
  document.querySelectorAll('div[data-testid="unlike"]')[0].click(); 
  window.scrollTo(0, window.pageYOffset+300);
}, 1000);

Hope this helps..

@pokacyb
Copy link

pokacyb commented Nov 15, 2021

It worked like a charm, thanks!

@andersondario
Copy link

andersondario commented Nov 19, 2021

Amazing! Thanks a lot!

@RimuleLeSlime
Copy link

RimuleLeSlime commented Dec 21, 2021

yeah thx

@YousraBD
Copy link

YousraBD commented Dec 23, 2021

Worked like a charm ! Thank you.

@luisnomad
Copy link

luisnomad commented Dec 24, 2021

Be careful with this, guys. After using it a couple of times, Twitter heavily penalized my account. It's like the algorithm has ostracised me, with 3k+ followers my engagement is next to null, and my tweet impressions are consistently below 20 in some cases. So much that I have decided to close my 10 years old account and start a new one.

@lionbytes
Copy link

lionbytes commented Dec 24, 2021

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

@luisnomad
Copy link

luisnomad commented Dec 24, 2021

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

@Maxfrommontreal
Copy link

Maxfrommontreal commented Jan 27, 2022

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

@vfanghao
Copy link

vfanghao commented Feb 8, 2022

Thanks!

@EduardoReisDev
Copy link

EduardoReisDev commented Mar 20, 2022

Thanks!!

@erbanku
Copy link

erbanku commented Mar 21, 2022

Thanks!

@AtalaySezen
Copy link

AtalaySezen commented Mar 23, 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!

@arshiardmhr
Copy link

arshiardmhr commented Apr 11, 2022

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

FranciscoMoretti commented Apr 21, 2022

The code from the last comment worked for me 👍

@knedl1k
Copy link

knedl1k commented May 5, 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 properly with over 25k likes. Thanks a lot!

@catielkerr
Copy link

catielkerr commented May 11, 2022

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

jeremiah-k commented May 22, 2022

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

0xfoobar commented Jun 10, 2022

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

Alex39-bot commented Jun 21, 2022

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.

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