Last active
April 12, 2022 09:34
-
-
Save hardiksondagar/65068f3b51258cd2d18d4869169cc5f4 to your computer and use it in GitHub Desktop.
Unlike or unfollow pages in Facebook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Unlike/unfollow pages in facebook. | |
* Open https://www.facebook.com/pages/?category=liked and scroll down till all liked/followed pages loads. | |
* Once all pages loads, copy paste this code in console and wait till all pages unliked/unfollowed (Use Google Chrome). | |
*/ | |
var pages_followed = document.querySelectorAll('[aria-label="Following"]'); | |
var pages_liked = document.querySelectorAll('[aria-label="Liked"]'); | |
function sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
async function remove(pages) { | |
for (let i=0; i < pages.length; i++) { | |
try { | |
let page = pages[i]; | |
page.click(); | |
console.log(`Page ${i+1} removed`); | |
} catch { | |
console.error(`Page ${i+1} remove failed`); | |
} finally { | |
await sleep(1000); | |
} | |
} | |
} | |
await remove(pages_liked); | |
await remove(pages_followed); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
very slow, and you can't get to the bottom of the list fast