Skip to content

Instantly share code, notes, and snippets.

@OriginalJef
Last active February 24, 2022 21:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OriginalJef/83381ed15437fc396b27dfc871f48cb8 to your computer and use it in GitHub Desktop.
Save OriginalJef/83381ed15437fc396b27dfc871f48cb8 to your computer and use it in GitHub Desktop.
How to decline all Facebook page like requests at once

How to decline all Facebook page like requests at once

If you want to do cleaning on your Facebook, you may want to decline all Facebook page like requests quickly. There is a way for that :

function sleep(ms) {
  return new Promise((resolve) => setTimeout(resolve, ms));
}

async function find_confirm() {
  if ([].slice.call(document.querySelectorAll('[aria-label="Confirm"]'))) {
    [].slice
      .call(document.querySelectorAll('[aria-label="Confirm"]'))[1]
      .click();
    await sleep(1000);
  }
}

async function find_decline() {
  if ([].slice.call(document.querySelectorAll('[role="menuitem"]'))) {
    [].slice.call(document.querySelectorAll('[role="menuitem"]'))[2].click();
    await sleep(1000);
    await find_confirm();
  }
}

async function handleClick(x) {
  x.click();
  await sleep(1000);
  await find_decline();
}

async function decline_all() {
  var data = [].slice.call(document.querySelectorAll('[aria-label="More"]'));
  for (let index = 1; index < data.length; index++) {
    const row = data[index];
    await handleClick(row);
  }
}

decline_all();
@maciekph
Copy link

Good script!
Changed above script a little bit to unlike all liked FB pages:

  1. Comment out await find_confirm();
  2. Changed [].slice.call(document.querySelectorAll('[role="menuitem"]'))[2].click(); to [].slice.call(document.querySelectorAll('[role="menuitem"]'))[0].click(); to simply click 1st menu item.

@minagendy
Copy link

can you plz put the full script of unlike all facebook pages here, because not working with me, thanks in advance

@SAFAD
Copy link

SAFAD commented Feb 24, 2022

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