Skip to content

Instantly share code, notes, and snippets.

@renestalder
Last active February 6, 2025 09:56
Show Gist options
  • Save renestalder/c5b77635bfbec8f94d28 to your computer and use it in GitHub Desktop.
Save renestalder/c5b77635bfbec8f94d28 to your computer and use it in GitHub Desktop.
Unfollow all on Facebook

Facebook: Unfollow people and pages

See comments section for more up-to-date versions of the script. The original script is from 2014 and will not work as is.

  1. Open news feed preferences on your Facebook menu (browser)
  2. Click people or pages
  3. Scroll down (or click see more) until your full list is loaded
  4. Run the script in your browser console

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.

var unfollowButtons = document.querySelectorAll('[data-followed="1"]'); for(var i=0;i<unfollowButtons.length;i++){ unfollowButtons[i].click(); } alert(unfollowButtons.length+' people are now unfollowed! ');
@ITz-SaGaR
Copy link

Anyone can provide the latest version of Script which will work with EN? Since now Unfollow comes after hovering on the Picture of the list.

@HVR88
Copy link

HVR88 commented May 3, 2024

Not going to happen. The changes to the page make it impossible to target the links the way the previous script employed.

Did anyone else come looking because of the news surrounding the "Unfollow Everything 2.0" lawsuit? That's going to fail. No extension or script will ever work for longer than a short period as Facebook are constantly changing their source and layouts. And no sourt can compell FB to not change their layout.

@ixus36900
Copy link

Encontré una manera de obtener los todos los enlaces de las personas que alguna vez les envié invitación de amistad y por defecto las empecé a seguir, es decir todos los seguidos que no se muestran normalmente. Pero ahora no se como hacer sin necesidad de API, solo con script de consola, hacer para dejar de seguir y cancelar solicitud de amistad a cada uno de esos perfiles. alguien sabe como?

@jcarroll
Copy link

jcarroll commented Sep 29, 2024

@ixus36900 asked about retracting sent (outgoing) friend requests, saying he found a way to get a list of links to the profiles of those whom he previously offered a friend request, and he's looking for a way to cancel (retract) those offers (requests).

Work in progress:

  1. https://www.facebook.com/friends/requests
  2. "View sent Requests"
    image
  3. Use the "inspect" tool to find the html class of the "cancel request" button element (today it was "x6s0dn4 x78zum5 xl56j7k x1608yet xljgi0e x1e0frkt")
    image
  4. Use the code that worked to "unfollow" all Friends, Groups, and Pages...
    https://gist.github.com/jcarroll/1b97f5f81c4668bf3dfdb97b0ac0eb02
  5. Replace [class="x1b0d499 xi3auck"] with the class from #3, above.
  6. Run code in console:

Results: It did cancel all outgoing request requests for me. However, it also accepted all incoming friend requests also.

To cancel outgoing requests and not accept incoming requests, I would next look for an htnl class that is shared by the "cancel request" elements that is not part of the accept request elements.

Unfortunately, since I just accepted all incoming friend requests, I don't have any of those elements to inspect.

I'll be very interested to see progress on this, especially anyone with steps to get it working.

-jFc

@jun-fajr
Copy link

Hi guys, does anyone have a new script that works? I tried this one, but it didn’t work.

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