Skip to content

Instantly share code, notes, and snippets.

@lanmaster53
Created July 11, 2023 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lanmaster53/c3084556876dec5de7bb23510fd05e75 to your computer and use it in GitHub Desktop.
Save lanmaster53/c3084556876dec5de7bb23510fd05e75 to your computer and use it in GitHub Desktop.
LinkedIn Unfollower Script
(() => {
let count = 0;
function getAllButtons() {
return document.getElementsByClassName('artdeco-button artdeco-button--muted artdeco-button--2 artdeco-button--secondary ember-view') || [];
}
async function unfollowAll() {
const buttons = getAllButtons();
for (let button of buttons) {
if (parseInt(button.id.replace("ember", "")) > 25 && button.innerText == "Following") {
button.click();
await new Promise((resolve) => setTimeout(resolve, 1000));
let modal_b = document.getElementsByClassName("artdeco-modal__confirm-dialog-btn artdeco-button artdeco-button--2 artdeco-button--primary ember-view")[0]
modal_b.click();
await new Promise((resolve) => setTimeout(resolve, 1000));
window.scrollTo(0, button.offsetTop - 260);
}
}
}
async function run() {
await unfollowAll();
window.scrollTo(0, document.body.scrollHeight);
await new Promise((resolve) => setTimeout(resolve, 10000));
const buttons = getAllButtons();
if (buttons.length) run();
}
run();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment