script to mass unfollow everyone on linkedin

Visit network-manager/people-follow/following/ and paste the script below to your browser console and hit enter. Then visit /network-manager/people-follow/followers/ and repeat the same.

function unfollowUser() {
  const followButtons = document.querySelectorAll(".artdeco-button__text");
  const followingButtons = Array.from(followButtons).filter(button => button.innerText.trim() === "Following");

  if (followingButtons.length > 0) {
    followingButtons[0].click();
    setTimeout(() => {
      const modal = document.querySelector(".artdeco-modal");

      if (modal) {
        const unfollowButton = modal.querySelector(".artdeco-modal__actionbar .artdeco-button--primary");
        if (unfollowButton) {
          unfollowButton.click();
        }
      }

      const closeButton = modal.querySelector(".artdeco-modal__dismiss");
      if (closeButton) {
        closeButton.click();
      }

      setTimeout(() => {
        unfollowUser();
      }, 1000);
    }, 1000);
  } else {
    setTimeout(() => {
      scrollDown();
    }, 1000);
  }
}

function scrollDown() {
  window.scrollTo(0, document.body.scrollHeight);
  setTimeout(() => {
    unfollowUser();
  }, 2000);
}

scrollDown();