Skip to content

Instantly share code, notes, and snippets.

@aelk00
Last active March 1, 2024 00:58
Show Gist options
  • Save aelk00/5a28f88e928db8fcd5c88d44ff65a4e0 to your computer and use it in GitHub Desktop.
Save aelk00/5a28f88e928db8fcd5c88d44ff65a4e0 to your computer and use it in GitHub Desktop.
Remove all your facebook likes
@froh42
Copy link

froh42 commented Dec 4, 2020

For Facebook in German:

setInterval(() => {
  for (const Button of document.querySelectorAll('div[aria-label="Weitere Optionen"]')) {
    Button.click()
for (const remove of document.querySelectorAll('div[role="menuitem"]')) {
    remove.click()      
  }
  }
}, 1000)

@Stell0
Copy link

Stell0 commented Dec 4, 2020

And for Italian:

setInterval(() => {
  for (const Button of document.querySelectorAll('div[aria-label="Opzioni di azione"]')) {
    Button.click()
for (const remove of document.querySelectorAll('div[role="menuitem"]')) {
    remove.click()      
  }
  }
}, 1000)

@tudorfil9
Copy link

def hits API limit. but i'll be back facebook, you little bitch

:))

@arvedinho
Copy link

For Facebook in German:

setInterval(() => {
  for (const Button of document.querySelectorAll('div[aria-label="Weitere Optionen"]')) {
    Button.click()
for (const remove of document.querySelectorAll('div[role="menuitem"]')) {
    remove.click()      
  }
  }
}, 1000)

Hey danke! Funktioniert wunderbar.

@nischolas
Copy link

nischolas commented Dec 4, 2020

Thank you for this! I tried this (German version) with filter category_key=LIKEDINTERESTS trying to 'reset' my timeline. The buttons were clicked, the list emptied pretty quickly object by object but after a refresh everything was still there.

I don't think the API limit is the cause because my liked pages are maybe in the hundreds 493, not tens of thousands like all liked posts.

@mylesholman
Copy link

Like a charm. Thanks!

@aelk00
Copy link
Author

aelk00 commented Dec 4, 2020

Thank you for this! I tried this (German version) with filter category_key=LIKEDINTERESTS trying to 'reset' my timeline. The buttons were clicked, the list emptied pretty quickly object by object but after a refresh everything was still there.
@nchlsschndr I didn't try it in other things.

@akdenizk
Copy link

akdenizk commented Dec 4, 2020

And for Facebook in Turkish:
setInterval(() => { for (const Button of document.querySelectorAll('a[aria-label="Düzenle"]')) { Button.click() for (const remove of document.querySelectorAll('a[role="menuitem"]')) { remove.click() } } }, 1000)

@GreenAstronaut
Copy link

For frenchies :

setInterval(() => {
  for (const Button of document.querySelectorAll('div[aria-label="Options d’action"]')) {
    Button.click()
for (const remove of document.querySelectorAll('div[role="menuitem"]')) {
    remove.click()      
  }
  }
}, 1000)

@HarimanDhanjal
Copy link

Sounds good! Thank you!
So if i unlike everything does this go off facebooks data base as well? or do they still have a copy?

@FilipLitwora
Copy link

For fb in Polish

setInterval(() => {
  for (const Button of document.querySelectorAll('div[aria-label="Opcje działania"]')) {
    Button.click()
for (const remove of document.querySelectorAll('div[role="menuitem"]')) {
    remove.click()      
  }
  }
}, 1000)

@michelep
Copy link

michelep commented Dec 4, 2020

Just click on THIS link to get the correct username of your profile ;-)

https://www.facebook.com/me/allactivity/?category_key=LIKEDPOSTS&filter_hidden=ALL&filter_privacy=NONE

@aelk00
Copy link
Author

aelk00 commented Dec 4, 2020

Just click on THIS link to get the correct username of your profile ;-)
@michelep thanks i will added this with your name

@zampemo
Copy link

zampemo commented Dec 15, 2020

Like @nchlsschndr says, I'm still getting EVERYTHING back as I refresh the page........... FB is so trash you can't remove posts, likes and so on!
Any chance to have this working properly? I've used the script translated in Italian as I needed that in my case. Thanks.

@IrakliK
Copy link

IrakliK commented Dec 17, 2020

@zampemo try re-running the script again ?

@nischolas
Copy link

@IrakliK Doesn’t work, I ran it three times.

@Zintom
Copy link

Zintom commented Jan 9, 2021

The original posted code doesn't appear to work at the moment.

I've tweaked it and have found that generally this works quite well:

setInterval(() => {
  for (const Button of document.querySelectorAll('div[aria-label="Action options"]')) {
    Button.click()
    document.querySelector('div[role="menuitem"]').click()
  }
}, 1000)

What this code does:
Every 1 second, it loops through every 'Action options' button on the page which is the ellipses button "...", it then queries the remove button and clicks it.

You can also change the interval to every 100ms which is pretty rapid and still works fine.

The old code seems to accidentally click the "forward" button leaving it eternally broken.

I hope this helps, and many thanks to @2xa31k for posting the initial code! 👍

@aelk00
Copy link
Author

aelk00 commented Jan 10, 2021

@Zintom Thank you I update the code .

@nischolas
Copy link

nischolas commented Jan 16, 2021

Just an update for category_key=LIKEDINTERESTS eg. liked pages and interests instead of posts. It just doesn't work. Even if I manually click the three dots and then 'Don't like anymore' (translated from german – could vary). After a page refresh everything's still there. So there's that. Can someone confirm this? Adblock was disabled just in case.

I also tried this … uh … more brutal and error prone approach. Buttons were clicked, list emptied pretty quickly. But after a refresh everything's still there. This and the updated script still work for category_key=LIKEDPOSTS though.

setInterval(() => {
    document.querySelector('div[aria-label="Weitere Optionen"]').click()
    document.querySelector('div[role="menuitem"]').click()
}, 100)

@Zintom
Copy link

Zintom commented Jan 16, 2021

@nchlsschndr From looking at the page it looks like it should still work, none of the variable names have changed; I know that there's some kind of rate limit on Facebook's end, maybe you're clicking too fast? Or maybe your browser is caching the items and they're actually gone? Idk but with my code posted above at 250ms per click it took around 45 mins to eliminate my entire Facebook like history (back to 2011).

Also, unless you're following literally thousands of pages, you should be able to do it manually in less than 10 minutes.

@nischolas
Copy link

nischolas commented Jan 16, 2021

@Zintom I know it should work. What filter exactly do you mean with

Facebook like history

?
Please note that I'm talking about category_key=LIKEDINTERESTS, not LIKEDPOSTS (that works). Cache was cleared, even tried on another browser with manual clicking. Seems like FB doesn't want you to unsubscribe from multiple pages in a too convenient way.

@Mywk
Copy link

Mywk commented Feb 11, 2022

To use in the Activity History:

setInterval(() => {
    document.querySelector('div[aria-label="Action options"]').click()
    document.querySelector('div[role="menuitem"]').click()
    document.querySelector('div[aria-label="Delete"]').click()
}, 400)

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