Skip to content

Instantly share code, notes, and snippets.

@2xa31k
Last active October 15, 2023 10:06
  • Star 111 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save 2xa31k/5a28f88e928db8fcd5c88d44ff65a4e0 to your computer and use it in GitHub Desktop.
Remove all your facebook likes
@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

@2xa31k
Copy link
Author

2xa31k 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 ?

@nchlsschndr
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! 👍

@2xa31k
Copy link
Author

2xa31k commented Jan 10, 2021

@Zintom Thank you I update the code .

@nchlsschndr
Copy link

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

@nchlsschndr
Copy link

nchlsschndr 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