Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joshbuchea/c44feb00f994b950048a6ed0fe55a60d to your computer and use it in GitHub Desktop.
Save joshbuchea/c44feb00f994b950048a6ed0fe55a60d to your computer and use it in GitHub Desktop.

Revisions

  1. @brunolemos brunolemos revised this gist May 13, 2020. 1 changed file with 13 additions and 2 deletions.
    15 changes: 13 additions & 2 deletions linkedin-unfollow-everyone.js
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,9 @@
    }

    async function unfollowAll() {
    for (let button of getAllButtons()) {
    const buttons = getAllButtons();

    for (let button of buttons) {
    count = count + 1;

    const name = button.parentElement.querySelector(
    @@ -21,5 +23,14 @@
    }
    }

    unfollowAll();
    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();
    })();
  2. @brunolemos brunolemos created this gist May 13, 2020.
    25 changes: 25 additions & 0 deletions linkedin-unfollow-everyone.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    (() => {
    let count = 0;

    function getAllButtons() {
    return document.querySelectorAll('button.is-following') || [];
    }

    async function unfollowAll() {
    for (let button of getAllButtons()) {
    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));
    }
    }

    unfollowAll();
    })();