Detox LinkedIn Feed :)

yutro

Yury Troynov

Posted on March 12, 2022

Detox LinkedIn Feed :)

Problem
wen you add new connection in LinkedIn you automatically start follow person (nobody asks if you want to). And then you have feed full of unwanted posts.

It's not comfortable to go and unfollow each time and there is no button unfollow all.

Solution

  1. open page where you have a list of contacts you follow (here)

  2. open browser developer tools console and paste below script there :)

(() => {
    const selectors = {
        followingButton: "button.is-following",
        followName: ".follows-recommendation-card__name",
    };

    const waitAround = (timeout = 100) =>
        new Promise((resolve) => {
            const randomTimeout =
                Math.random() * (timeout - timeout / 2) + timeout / 2;

            setTimeout(resolve, randomTimeout);
        });

    const getAllFollowingButtons = () =>
        Array.from(document.querySelectorAll(selectors.followingButton));

    const getPendingUnfollowAll = async () => {
        const buttons = getAllFollowingButtons();

        for (const button of buttons) {
            const name = button.parentElement.querySelector(
                selectors.followName
            ).innerText;

            console.log(`Unfollow ${name}`);

            window.scrollTo(0, button.offsetTop - 260);

            button.click();
            await waitAround(300);
        }
    };

    const start = async () => {
        await getPendingUnfollowAll();

        window.scrollTo(0, document.body.scrollHeight);

        await waitAround(500);

        const buttons = getAllFollowingButtons();

        if (buttons.length) {
            await start();
        }
    };

    start().then(() => {
        console.log("unfollow all done !");
    });
})();
Enter fullscreen mode Exit fullscreen mode

hit enter and enjoy clean feed line :)

💖 💪 🙅 🚩
yutro
Yury Troynov

Posted on March 12, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related