DEV Community

loading...

Tune down LinkedIn noise with JS

hydroweaver profile image Karan ・2 min read

image

Hi everyone,

I recently realised how much useless likes, follows, shares are on my LinkedIn feed and decided to make a change, by unfollowing several people at once. However LinkedIn doesn't provide this option (or atleast I don't know about it). The method is fairly simple and many people have done this already, but here's my take.

Explore

Go to manage followers page and click on x Following next to Follow fresh perspectives. Hit Inspect on the Following check on any of the people on it. On inspecting you'll see the massive DOM with too much information.

What's it about?

It's just a button which toggles between follow and unfollow.

What do we want to do?

Assuming you want to unfollow everyone. Click on all these Following buttons on this page and that's where JS comes in handy. When you're following someone the button will be of let's say CLASS FOLLOWING and CLASS NOT FOLLOWING otherwise.

What we'll do?

Just loop over all these Following buttons. Check out this link.

How?

In console, this is what you do, while being on the same page. Now this might be kind of stupid/naive way of doing it, but it worked.

//Create a variable that refers to the **CLASS FOLLOWING** buttons on this page.

var follow = document.getElementsByClassName("SEARCH THE CLASS ;)");

//get follow length, that is, how many buttons are there on the current scroll, since they increase when you go down, responsive web design or whatever that is.

var followLength = follow.length;

//loop over all the buttons and click them one by one, thereby unfollowing people.

for(var i =0;i<followLength;i++){
        follow[0].click();
    }

Limitations

  1. Since I'm a JS noob, the follow length updates while the page is scrolled down, this might cause some trouble.
  2. If you're following everyone, like say 500 people like I did, It can just halt chrome to a grind!
  3. I frankly get confused by following/followers page, because followers page also has the same button and then it resets itself, because....I'm not able to explain it, but why can't LinkedIn make it on the same page?!So you might want to check this behaviour out and see how it works for a couple of people.

I tried this because I wanted to unfollow everyone, in case you do, you might want to follow a small set of people who are relevant to your case, otherwise you'll end up checking/unchecking them again manually!

Oh and don't forget to click on the DONE button on top to refresh your feed! :)

Have fun!

Discussion (0)

pic
Editor guide