Skip to content

Instantly share code, notes, and snippets.

@dante4rt
Created April 17, 2025 13:20
Show Gist options
  • Save dante4rt/d18cab065f4c968e0d57673574eedd19 to your computer and use it in GitHub Desktop.
Save dante4rt/d18cab065f4c968e0d57673574eedd19 to your computer and use it in GitHub Desktop.
This JavaScript snippet automates the process of unfollowing all users on LinkedIn's following page (https://www.linkedin.com/mynetwork/network-manager/people-follow/following/). It continuously checks for "Following" buttons, clicks them to unfollow users, and scrolls to load more users until all users are unfollowed.
(function unfollowAll() {
const followingButtons = document.querySelectorAll("span.artdeco-button__text");
if (followingButtons.length === 0) {
console.log("No more 'Following' buttons found.");
return;
}
followingButtons.forEach((button) => {
if (button.innerText === "Following") {
button.click();
console.log("Clicked 'Following'");
}
});
window.scrollTo(0, document.body.scrollHeight);
console.log("Scrolled down");
setTimeout(unfollowAll, 2000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment