Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Delete all your favorites (unfavorite or unlike every tweet) on twitter.com (thx to @JamieMason and @b44rd for inspiring this)
// 1. Go to https://twitter.com/i/likes
// 2. Keep scrolling to the bottom repeatedly until all your favs are loaded.
// 3. Run this in your console (open in chrome by View > Developer > JavaScript Console)
// Notes: this may take a while if you have a lot of favs/likes
// you can only access your most recent ~2000 likes.
// inspired by https://gist.github.com/JamieMason/7580315
$('.ProfileTweet-actionButtonUndo').click()
@joshualambert

This comment has been minimized.

Copy link

@joshualambert joshualambert commented Feb 26, 2018

Super cool! Thanks for sharing.

@christianbundy

This comment has been minimized.

Copy link

@christianbundy christianbundy commented Mar 14, 2018

This also clicks the "undo retweet" button. Try this instead:

$('.ProfileTweet-actionButtonUndo.ProfileTweet-action--unfavorite').click();
@JayMonies

This comment has been minimized.

Copy link

@JayMonies JayMonies commented Mar 19, 2018

Is there a way to do this the other way with liking?

@newscloud

This comment has been minimized.

Copy link

@newscloud newscloud commented Apr 12, 2018

I customized the script with a timed scroll loop
Delete your favorites

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented May 20, 2018

The link above worked effectively for me. Thank you.

@bad1deafactory

This comment has been minimized.

Copy link

@bad1deafactory bad1deafactory commented Oct 11, 2018

had to make an account just to say thanks! nothing i was finding online worked :)

@R0tator

This comment has been minimized.

Copy link

@R0tator R0tator commented Nov 25, 2018

thanks man it worked. for some reason there was showing 72 likes without any liked post.

@pdkpv

This comment has been minimized.

Copy link

@pdkpv pdkpv commented Jan 26, 2019

thanks man it worked. for some reason there was showing 72 likes without any liked post. @fahimkingfisher

This is a Twitter bug. The same will happen if you delete all the tweets - the counter will show phantom tweets :)

UPD (09.02.19): Phantom likes loaded - launched a script for them (it worked).

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Jan 28, 2019

Thanks!

@Retrosexual

This comment has been minimized.

Copy link

@Retrosexual Retrosexual commented Mar 16, 2019

thanks man it worked. for some reason there was showing 72 likes without any liked post. @fahimkingfisher

This is a Twitter bug. The same will happen if you delete all the tweets - the counter will show phantom tweets :)

UPD (09.02.19): Phantom likes loaded - launched a script for them (it worked).

Hey is there a way to force load the phantom likes. Do you just have to get lucky?

I Ran the script and it removed a couple of thousand old likes (thank you so much), but I still have about another thousand phantom likes. (twitter shows I have 1.6k likes, but when you click my likes it says this account hasn't liked anything) Do I just have to wait it out for the server to refresh?

@mochsner

This comment has been minimized.

Copy link

@mochsner mochsner commented Apr 2, 2019

thanks man it worked. for some reason there was showing 72 likes without any liked post. @fahimkingfisher

This is a Twitter bug. The same will happen if you delete all the tweets - the counter will show phantom tweets :)
UPD (09.02.19): Phantom likes loaded - launched a script for them (it worked).

Hey is there a way to force load the phantom likes. Do you just have to get lucky?

I Ran the script and it removed a couple of thousand old likes (thank you so much), but I still have about another thousand phantom likes. (twitter shows I have 1.6k likes, but when you click my likes it says this account hasn't liked anything) Do I just have to wait it out for the server to refresh?

@retro
Had some fun messing around with this, and I think that phantom likes are a fairly unavoidable drawback of browser/JS based deletion. For me, the tweets (not all, but some) actually did still exist there as likes, but the heart icon wasn't colored red anymore.

Twitter may design their front-end to prevent a mass deletion of tweets, but I almost find it more likely that this is simply a result of jQuery, which doesn't function very well with dynamically generated content. Would definitely recommend checking out their API if you get the chance (imo via Python), or use a 3rd party service like https://gocardigan.com if you're really just trying to delete your tweets without the fuss.

Another thing worth throwing out there is that Twitter has released a new desktop mode, which may be more updated & run more smoothly with this jQuery command. If you check it out, definitely let us know how it compares!

@citronrobotlord

This comment has been minimized.

Copy link

@citronrobotlord citronrobotlord commented May 11, 2019

I'm getting

Uncaught TypeError: Cannot read property 'click' of null at <anonymous>:1:68

@citronrobotlord

This comment has been minimized.

Copy link

@citronrobotlord citronrobotlord commented May 11, 2019

thanks man it worked. for some reason there was showing 72 likes without any liked post. @fahimkingfisher

This is a Twitter bug. The same will happen if you delete all the tweets - the counter will show phantom tweets :)

UPD (09.02.19): Phantom likes loaded - launched a script for them (it worked).

how did you do this? I have like 13K tweets that are in my likes but apparently I haven't liked them. I think twitter might have forgotten that the button was pressed but didn't remove them from my likes. but I want to clear them all away.

@passmethemike

This comment has been minimized.

Copy link

@passmethemike passmethemike commented Aug 8, 2019

Tried running this but get an error:

Uncaught TypeError: Cannot read property 'click' of null at :1:68

Is there a fix for this?

@ashander

This comment has been minimized.

Copy link
Owner Author

@ashander ashander commented Aug 8, 2019

@passmethemike no clue offhand, sorry. twitter has redesigned the web front end so I'm not surprised if this no longer work. following @mochsner advice and using the api is a better bet if this no longer works

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Aug 22, 2019

This surely work:

  1. Go to "like" page
  2. For num in range(1, $number_of_favorite_tweets)
    Press key " J ". Then press " L ";
  3. Can use Autohotkey (on windows) or Autokey (on Linux) for doing step 2.
@eaghayi

This comment has been minimized.

Copy link

@eaghayi eaghayi commented Aug 29, 2019

None of the above solutions does NOT work. Please let us know if you have any more solution.

@aymericbeaumet

This comment has been minimized.

Copy link

@aymericbeaumet aymericbeaumet commented Sep 4, 2019

@eaghayi: see this script which works with the latest Twitter version

@primroserobin

This comment has been minimized.

Copy link

@primroserobin primroserobin commented Aug 22, 2020

how to get rid of phantom likes ?

@domibor19

This comment has been minimized.

Copy link

@domibor19 domibor19 commented Sep 3, 2020

does not work

@ashander

This comment has been minimized.

Copy link
Owner Author

@ashander ashander commented Sep 3, 2020

@domibor19 see the other comments

@RRR2020-Temp

This comment has been minimized.

Copy link

@RRR2020-Temp RRR2020-Temp commented Oct 13, 2020

Hi, I used the code to delete my twitter likes but it has left a lot of "ghost" likes behind. Anyone know how to resolve this?

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