Skip to content

Instantly share code, notes, and snippets.

@narze
Forked from heypoom/unfollow-all.js
Last active January 8, 2022 13:13
Show Gist options
  • Save narze/97c65a501c735af5b182714fad1391cf to your computer and use it in GitHub Desktop.
Save narze/97c65a501c735af5b182714fad1391cf to your computer and use it in GitHub Desktop.
async function run() {
const wait = ms => new Promise(resolve => setTimeout(resolve, ms))
const selector = 'div[aria-label="Toggle to follow"] div'
const nodes = [...document.querySelectorAll(selector)]
if (!nodes.length) return
for (let node of nodes) {
const text = node.parentElement.parentElement.parentElement.innerText
console.log(text)
if (!text.includes('Following')) {
// Remove Unfollowed node so that it will save some RAM
node.parentElement.parentElement.parentElement.parentElement.parentElement.remove()
continue
}
node.click()
await wait(100)
}
// Run again until no entries left
run()
}
// Click on the arrow on the upper right > settings and privacy > news feed preferences > unfollow > run this code on DevTools
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment