Last active
June 5, 2023 12:48
-
-
Save MoatazAbdAlmageed/1c2aa2ff0f7feec0b6cdc3ac37ac25a9 to your computer and use it in GitHub Desktop.
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
if you unfollow all as shown here https://www.linkedin.com/pulse/mass-unfollow-linkedin-connections-mighil-/ | |
and need to undo this action Go to https://www.linkedin.com/mypreferences/d/unfollowed and past this into the browser console in hit enter | |
``` | |
(() => { | |
let count = 0; | |
function getAllButtons() { | |
return document.querySelectorAll('.remove-btn') || []; | |
} | |
async function followAll() { | |
const buttons = getAllButtons(); | |
for (let button of buttons) { | |
count = count + 1; | |
console.log(`follow #${count}:`); | |
window.scrollTo(0, button.offsetTop - 260); | |
button.click(); | |
await new Promise((resolve) => setTimeout(resolve, 100)); | |
} | |
} | |
async function run() { | |
await followAll(); | |
window.scrollTo(0, document.body.scrollHeight); | |
await new Promise((resolve) => setTimeout(resolve, 1000)); | |
const buttons = getAllButtons(); | |
if (buttons.length) run(); | |
} | |
run(); | |
})(); | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment