Skip to content

Instantly share code, notes, and snippets.

@jcarroll
Forked from renestalder/README.md
Last active April 17, 2024 18:05
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcarroll/cc3e0880316e0dfad6f2dd37fdc25cc8 to your computer and use it in GitHub Desktop.
Save jcarroll/cc3e0880316e0dfad6f2dd37fdc25cc8 to your computer and use it in GitHub Desktop.
Unfollow all on Facebook

Facebook: Unlike All Pages from Activity Log

  1. Facebook Settings & Privacy

  2. Activity Log

  3. Connections

  4. Pages, page likes and interests

  5. Replace the following line with today's class (see screenshot)

    [class="x6s0dn4 x78zum5 x1q0g3np x1iyjqo2 x1qughib xeuugli"]

  6. Run the script in your browser console

I'm told that "Facebook will block this feature for you while you use it, depending on how much entities you try to unfollow. It automatically unblocks in a couple of hours and you will be able to continue."

(async () => {
var logs = document.querySelectorAll("*");
for (let i = 0; i < logs.length; i++) {
try {
const logElement = logs[i];
logElement.querySelector(selectors().moreActions).click();
await wait(1500);
document
.querySelector(selectors().unlikeBtn)
.click();
await wait(500);
i--;
}
catch (error) {
console.log(error);
}
}
})();
function selectors() {
return {
moreActions: `[aria-label="Action options"]`,
unlikeBtn: `[class="x6s0dn4 x78zum5 x1q0g3np x1iyjqo2 x1qughib xeuugli"]`, // Update this line every day!
};
}
function wait(milliseconds) {
return new Promise((resolve) => {
setTimeout(() => {
resolve(null);
}, milliseconds);
});
}
@jcarroll
Copy link
Author

jcarroll commented Aug 6, 2023

It worked for me on 6 Aug 2023; this screenshot shows how to find the class id; in order for the script to work for you, follow the same process to get today's class id.
Screenshot 2023-08-06 6 38 36 PM

@tomeytran
Copy link

Wow thank you so much! It works, and it also works when I try on Stories activity as well

@tokazama2
Copy link

Thank you so much! I have now spent over 5 hours trying to clean up my mom's facebook. She had liked over 500 pages and was getting so very much spam. some of it was pretty graphic. you saved me so much time!

@jcarroll
Copy link
Author

Thank you so much, @tomeytran and @tokazama2 for letting me know that this helped you. It means so much to me to read your feedback.

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