8

[Recipe] Delete all your likes/favorites from Twitter

 2 years ago
source link: https://gist.github.com/aymericbeaumet/d1d6799a1b765c3c8bc0b675b1a1547d
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

[Recipe] Delete all your likes/favorites from Twitter · GitHub

Instantly share code, notes, and snippets.

[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)

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?

My problem is that the code unlikes the tweets but instantly likes them again. Couldn't it just be that the code is outdated due to changes done by Twitter? Any help for me there?

image

I had the same issue, seemed to be caused by hitting the API rate limit, so the "likes" and "unlikes" from the client stop being accepted by the server, so they just seem to revert on their own.
Only thing that worked for me was to wait a few days/weeks and try again, as the API rate limits reset eventually.

Thank you!

You're welcome! You can see all the errors are code 429 too, which is "too many requests" https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429

Facing the same issue?

I've to wait for 5-10 mins in order to unlike other 200-300 tweets. Is there any way we can attach time limit to the script so that it doesn't exceed the API limit but keep on unliking it?

Rylon commented on Aug 22, 2021

edited

My problem is that the code unlikes the tweets but instantly likes them again. Couldn't it just be that the code is outdated due to changes done by Twitter? Any help for me there?

image

I had the same issue, seemed to be caused by hitting the API rate limit, so the "likes" and "unlikes" from the client stop being accepted by the server, so they just seem to revert on their own.
Only thing that worked for me was to wait a few days/weeks and try again, as the API rate limits reset eventually.

Thank you!

You're welcome! You can see all the errors are code 429 too, which is "too many requests" https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429

Facing the same issue?

I've to wait for 5-10 mins in order to unlike other 200-300 tweets. Is there any way we can attach time limit to the script so that it doesn't exceed the API limit but keep on unliking it?

There's usually a HTTP header in the response which will tell you when you can try again, such as a Retry-After header. I've not looked into the Twitter API, but if it returns such a header when you get a 429, it should be possible to modify the script to read that, and use the value to wait before continuing.

GarlandKey commented on Aug 22, 2021

edited

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)

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

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

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 commented on 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.

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

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

It worked like a charm, thanks!

Amazing! Thanks a lot!

Worked like a charm ! Thank you.

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.

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

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

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

vfanghao commented on Feb 8

Thanks!

Thanks!!

erbanku commented on Mar 21

Thanks!

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!

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.

The code from the last comment worked for me +1

knedl1k commented 27 days ago

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!

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

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 commented 16 hours ago

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

It started un following person whom I follow

311298 commented 16 hours ago

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

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK