Last active
February 24, 2024 01:54
-
-
Save nathansmith/95b642075d4b145125806fa68c9d6205 to your computer and use it in GitHub Desktop.
Console script to "follow back" everyone on LinkedIn.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
===== | |
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