Skip to content

Instantly share code, notes, and snippets.

@SAFAD
Created February 24, 2022 20:57
Show Gist options
  • Save SAFAD/dfc16d4d485aa78031d47c458e7b652e to your computer and use it in GitHub Desktop.
Save SAFAD/dfc16d4d485aa78031d47c458e7b652e to your computer and use it in GitHub Desktop.
How to unlike all Facebook page at once

Unlike all facebook pages 2022

Go to: https://m.facebook.com/pages/launchpoint/liked_pages

Paste the following script into console (F12 -> console):

var unlike_all = ()=> {
	[].slice.call(document.querySelectorAll('[data-sigil="action-title"')).filter(x=>x.innerText.indexOf('Unlike') !=-1).map(x=>{x.click()});
	window.scrollTo(0,document.body.scrollHeight);
	window.setTimeout(unlike_all, 3 * 1000)
};
unlike_all();

you're done!

@iatpatelishan
Copy link

[].slice.call(document.querySelectorAll('[aria-label="Action options"')).map(x=>{x.click()})

setInterval(function(){
  [].slice.call(document.querySelectorAll('[role="menuitem"')).filter(x=>x.innerText.indexOf('Unlike') !=-1).map(x=>{x.click()})
  setInterval(function(){
    location.reload();
  },1000);

},1000);

@leviouwendijk
Copy link

It works very well but at some point facebook shrinks the amount of pages that appear in the activity log upon refreshing. Eventually it says "Nothing to show" even though there's about 600+ pages that are still liked. After waiting I can continue, but I don't know upon what length of time this is based.

@tlorien
Copy link

tlorien commented Jun 5, 2024

This script works:

(function() {
    function unlikeAllLikedPages() {
        const actionButtons = document.querySelectorAll('[aria-label="Action options"]');
        actionButtons.forEach(button => button.click());

        setTimeout(() => {
            const unlikeButtons = Array.from(document.querySelectorAll('[role="menuitem"]')).filter(button => button.innerText.includes('Unlike'));
            unlikeButtons.forEach(button => button.click());
        }, 1000);
    }

    // Execute the function
    unlikeAllLikedPages();
})();

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