Skip to content

Instantly share code, notes, and snippets.

@philippebarbosa
Last active August 24, 2022 01:40
Show Gist options
  • Save philippebarbosa/8454475 to your computer and use it in GitHub Desktop.
Save philippebarbosa/8454475 to your computer and use it in GitHub Desktop.
A simple way to unlike all facebook page in one time !

How to unlike all Facebook page at once

If you want to do cleaning on your Facebook timeline, you may want to unlike all Facebook pages quickly. There is a way for that :

  • Go to firefox and install iMacros
  • Open a text editor (i.e. Notepad, Sublime Text), and paste that code inside :
VERSION BUILD=7401110 RECORDER=FX
TAB T=1
TAG POS=1 TYPE=SPAN ATTR=TXT:Unlike
TAG POS=2 TYPE=SPAN ATTR=TXT:Unlike
TAG POS=3 TYPE=SPAN ATTR=TXT:Unlike
TAG POS=4 TYPE=SPAN ATTR=TXT:Unlike
TAG POS=5 TYPE=SPAN ATTR=TXT:Unlike
WAIT SECONDS=1
  • Save with .iim extension at C:\Users\YouUsername\Documents\iMacros\Macros for Windows or /Users/YourUsername/iMacros/Macros for OsX
  • Go to Facebook (logged) on that page
  • Open iMacros and launch the script, repeat it more needed (i.e. 9999).
  • Because of infinite scrolling from Facebook, you may repeat it few time.
  • You're welcome !
@digggggggggg
Copy link

I wrote a script to automatically unlike all things.
don't use this if you don't know what it does, use at your own risk, etc

  1. go to https://www.facebook.com/browse/other_connections_of/
  2. open console and execute the code below.
const unlike_all = ()=> {
	[].slice.call(document.querySelectorAll('a[role=button]')).filter(x=>x.innerText=='Unlike').map(x=>{x.click(); x.remove()});
	[].slice.call(document.querySelectorAll('a[role=button][action=cancel]')).map(x=>x.click());
	window.scrollTo(0,document.body.scrollHeight);
	window.setTimeout(unlike_all, 3 * 1000)
};
unlike_all();

The script will unlike all pages, scroll to the bottom of the page, unlike all the new items in the list, scroll down again, unlike again, until there is nothing left to unlike.

don't use this if you don't know what it does, use at your own risk, etc

@digggggggggg
Copy link

Here's something you can just run from the console: https://gist.github.com/mattmarcum/92cff950e25fa5f39f5fc05f1b22c75f

that gist doesn't scroll down the page so you have to paste and run over and over again, that's why I wrote the above. Hope it helps.

@malterb
Copy link

malterb commented Sep 14, 2019

For me, it worked to go to https://www.facebook.com/pages/?category=liked

and run

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

@BillTribble
Copy link

Hey thanks @elmalto, this works great!
Can anyone figure out how to 'Unlike' ALL activity? I've been experimenting on the 'Activity log' page but can't figure it out (I'm no JS dev!)

@magusverma
Copy link

elmato's script worked like a charm

@tiagoad
Copy link

tiagoad commented Oct 26, 2020

Here's something that works with the newest version. You need to change "Liked" to your local language.

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

@trievis
Copy link

trievis commented Oct 28, 2020

The script should work with following modification:

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

@OriginalJef
Copy link

If you also want to decline all page like requests: https://gist.github.com/OriginalJef/83381ed15437fc396b27dfc871f48cb8

@erubenz
Copy link

erubenz commented Mar 24, 2021

I tried the script and it deletes only active pages, deleted once stays in likes section. Is it possible to remove them too? Thanks

@ahmedcfx
Copy link

Don't waste your time guys, it's not working.

@SAFAD
Copy link

SAFAD commented Feb 24, 2022

As of 24/02/2022 this is the new and working method: https://gist.github.com/SAFAD/dfc16d4d485aa78031d47c458e7b652e

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