Skip to content

Instantly share code, notes, and snippets.

@mattmarcum
Created February 12, 2018 23:03
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mattmarcum/92cff950e25fa5f39f5fc05f1b22c75f to your computer and use it in GitHub Desktop.
Save mattmarcum/92cff950e25fa5f39f5fc05f1b22c75f to your computer and use it in GitHub Desktop.
Console script to unlike everything you ever liked on facebook
/*
This works on 2/12/2018, but will need to be updated as facebook updates it's DOM
1: Go to your profile, click More->Likes
2: Scroll down to the bottom of the page and keep scrolling as facebook loads more of your 'likes'
3: Open the console and c&p this:
*/
document.querySelectorAll('button.PageLikedButton').forEach(b=>b.click());
document.querySelectorAll('li[data-label="Unlike"] a').forEach(a=>a.click());
@tatiana-scda
Copy link

not working anymore?

@nirbhikjangid
Copy link

Thanks a ton for this!
@tatiana-scda it is working, just paste the second line of code again & press enter.

@Dawoodshah100
Copy link

Dawoodshah100 commented Oct 23, 2018

Works, Run it once and then wait for little when little Unlike button appears, run again!!!
Thanks for making it!

@TheGroundZero
Copy link

TheGroundZero commented Jul 16, 2019

Works like a charm!

You may need to change the "Unlike" text to fit your language for it to work in your case.

Also, this will unlike all pages within your view, so usually like 25 at a time or so.
Scrolling down in the page will make more pages visible, but will increase the time the script takes.
Unless you can fit all your liked pages in 1 view without needing to scroll for hours, I suggest repeating the script (for hours) instead. Looping the script will cause slow-down and errors.

This may work, use at own risk:

function loop() {
  setTimeout(function unlike() {
    document.querySelectorAll('button.PageLikedButton').forEach(b=>b.click());
    document.querySelectorAll('li[data-label="Unlike"] a').forEach(a=>a.click()); // Change 'Unlike' to fit your localised version
    loop();
  }, 0);
}
loop();

@TheGroundZero
Copy link

You may get rate limited using this script.
This'll result in Likes appearing to have been removed, while they'll apparently remain active somehow and they slowly reappear on your profile.

So add some rate limiting (sleep) to the script. This'll ofcourse slow it down a lot.

afbeelding

@sdsdfhkje4
Copy link

sdsdfhkje4 commented May 11, 2020

@TheGroundZero

So add some rate limiting (sleep) to the script. This'll ofcourse slow it down a lot.

how do i add a sleep script?

@KimberlyShein
Copy link

KimberlyShein commented Dec 6, 2020

Please I hope there will be an update on this on the new facebook. Does it work with u guys?
It seems it doesn't work on me anymore. :(

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