Skip to content

Instantly share code, notes, and snippets.

@fineanmol
Created November 30, 2022 18:44
Show Gist options
  • Save fineanmol/9da3efc137abb0526bc57a045e7b1ccd to your computer and use it in GitHub Desktop.
Save fineanmol/9da3efc137abb0526bc57a045e7b1ccd to your computer and use it in GitHub Desktop.
(() => {
let count = 0;
function getAllButtons() {
return document.querySelectorAll('button.is-following') || [];
}
async function unfollowAll() {
const buttons = getAllButtons();
for (let button of buttons) {
count = count + 1;
const name = button.parentElement.querySelector(
'.follows-recommendation-card__name',
).innerText;
console.log(`Unfollow #${count}:`, name);
window.scrollTo(0, button.offsetTop - 260);
button.click();
await new Promise((resolve) => setTimeout(resolve, 100));
}
}
async function run() {
await unfollowAll();
window.scrollTo(0, document.body.scrollHeight);
await new Promise((resolve) => setTimeout(resolve, 1000));
const buttons = getAllButtons();
if (buttons.length) run();
}
run();
})();
@fineanmol
Copy link
Author

For people just having this gist link:

Open https://linkedin.com/feed/following/
Open Dev Tools > Console (Cmd+Option+J)
Paste the script & press enter

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