Skip to content

Instantly share code, notes, and snippets.

@nathansmith
Last active February 24, 2024 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathansmith/95b642075d4b145125806fa68c9d6205 to your computer and use it in GitHub Desktop.
Save nathansmith/95b642075d4b145125806fa68c9d6205 to your computer and use it in GitHub Desktop.
Console script to "follow back" everyone on LinkedIn.
/*
=====
NOTE:
=====
This works with LinkedIn's current markup, as of 2024-02-23.
Run it via the dev tools console, while on your "following" page.
https://linkedin.com/mynetwork/network-manager/people-follow/followers
*/
(() => {
const fireButtonClick = () => {
// Get buttons.
const buttonFollowList = document.querySelectorAll('button[aria-label^="Click to follow"]');
const buttonFollowingList = document.querySelectorAll('button[aria-label^="Click to stop following"]');
// Loop through.
buttonFollowList.forEach((button) => {
// Fire event.
button.click();
});
// Loop through.
buttonFollowingList.forEach((button) => {
// Hide row.
button.closest('li.reusable-search__result-container')?.remove();
});
// Get "show more" button.
const buttonShowMore = document.querySelector('.scaffold-finite-scroll__load-button');
// Button exists: YES.
if (buttonShowMore) {
// Fire event.
buttonShowMore.click();
}
}
// Set timer.
setInterval(fireButtonClick, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment