Skip to content

tlorien/Unlike-Everything-on-Facebook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 

Repository files navigation

Unlike Everything on Facebook

Prefer a userscript version? Click here.

This project contains a simple JavaScript script to automatically unlike all liked pages on the Facebook Activity Log page. The script simulates user interactions by clicking the necessary buttons to unlike each page.

Why?

Privacy Concerns: Liking pages on Facebook means sharing your interests and preferences with not only your friends but also the page administrators, Facebook, advertisers, and data brokers. This can lead to targeted advertising and profiling that follows you across the internet. By unliking pages, you reduce the amount of personal information that is visible to third parties.

Security Risks: Some Facebook pages may not be adequately secure and can become compromised. Facebook pages directly connect users to content, and as such are hot commodities for malicious entities (governments, terrorist groups, data brokers, hackers, etc) to spread misinformation, propaganda, scams, and spam. If you are connected to these pages, your account might be exposed to phishing attacks, security threats, or general annoyances. By minimizing your connections, you reduce the potential attack surface for malicious activities.

Data Minimization: Reducing the amount of data you share on social media platforms is a good practice for managing your digital footprint. It can help prevent further data breaches and the unauthorized use of your personal information, including its use in training large language models (LLMs) like ChatGPT.

Decluttering Your Feed: Over time, you might have liked many pages that no longer interest you (or now post irrelevant or dangerous content) leading to a cluttered news feed. Unliking these pages can help you regain control over the content you see and ensure that your feed is more relevant to your current interests.

Usage

Note: this script only works if the language on the page is set to English.

To use this script, follow these steps on your desktop computer:

  1. Open the Console: In your browser, right-click on the Facebook page where all the liked pages are listed and select "Inspect", or press Ctrl+Shift+I (Windows) or Cmd+Option+I (Mac), to open the Developer Tools. Navigate to the "Console" tab.

  2. Copy and Paste the Script: Copy the code below and paste it into the console:

(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();
})();
  1. Run the Script: Press Enter to run the script. The script will:

    • Find all buttons labeled "Action options" and click them.
    • Wait for a second to ensure the menu items are loaded.
    • Find all menu items with the text "Unlike" and click them to unlike the pages.
  2. Re-run the script as many time as necessary to remove all likes.

  3. In addition to the above script, the following script can be used on the All Activity page to delete all of your activity (comments, reactions, likes, etc).

USE WITH CAUTION AS THIS IS IRREVERSIBLE:

function handleMenuActions() {
  const menuItems = [...document.querySelectorAll('[role="menuitem"]')];
  menuItems.forEach(item => {
    const text = item.innerText.toLowerCase();
    if (text.includes('unlike') || text.includes('delete') || text.includes('remove reaction')) {
      item.click();
    }
  });
}

function unlikeAll() {
  const actionButtons = [...document.querySelectorAll('[aria-label="Action options"]')];
  let currentIndex = 0;

  function processNextButton() {
    if (currentIndex < actionButtons.length) {
      actionButtons[currentIndex].click();
      setTimeout(() => {
        handleMenuActions();
        currentIndex++;
        setTimeout(processNextButton, 1000); // Delay to ensure the action is processed
      }, 500); // Delay to ensure the menu is fully loaded
    } else {
      console.log('All actions processed.');
    }
  }

  processNextButton();
}

unlikeAll();

Contributing

If you have any suggestions or improvements, feel free to open an issue or submit a pull request.

Want to unfollow all of your followed pages on Instagram? Check out my other script!

About

A simple browser script to unlike everything on Facebook.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published