Detox LinkedIn Feed :)
Yury Troynov
Posted on March 12, 2022
Problem
wen you add new connection in LinkedIn you automatically start follow person (nobody asks if you want to). And then you have feed full of unwanted posts.
It's not comfortable to go and unfollow each time and there is no button unfollow all.
Solution
open page where you have a list of contacts you follow (here)
open browser developer tools console and paste below script there :)
(() => {
const selectors = {
followingButton: "button.is-following",
followName: ".follows-recommendation-card__name",
};
const waitAround = (timeout = 100) =>
new Promise((resolve) => {
const randomTimeout =
Math.random() * (timeout - timeout / 2) + timeout / 2;
setTimeout(resolve, randomTimeout);
});
const getAllFollowingButtons = () =>
Array.from(document.querySelectorAll(selectors.followingButton));
const getPendingUnfollowAll = async () => {
const buttons = getAllFollowingButtons();
for (const button of buttons) {
const name = button.parentElement.querySelector(
selectors.followName
).innerText;
console.log(`Unfollow ${name}`);
window.scrollTo(0, button.offsetTop - 260);
button.click();
await waitAround(300);
}
};
const start = async () => {
await getPendingUnfollowAll();
window.scrollTo(0, document.body.scrollHeight);
await waitAround(500);
const buttons = getAllFollowingButtons();
if (buttons.length) {
await start();
}
};
start().then(() => {
console.log("unfollow all done !");
});
})();
hit enter and enjoy clean feed line :)
💖 💪 🙅 🚩
Yury Troynov
Posted on March 12, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
react How to build type-enforced UI components in React Native using @shopify/restyle
November 28, 2024