Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save suhailroushan13/11c5386803c93e05fa8af08b362222e4 to your computer and use it in GitHub Desktop.

Select an option

Save suhailroushan13/11c5386803c93e05fa8af08b362222e4 to your computer and use it in GitHub Desktop.
// THIS SCRIPT ALLOW YOU TO ACCEPT ALL THE CONNECTION REQUESTION IN ONE GO. ON LINKEIND
// USE IT AT YOUR OWN RISK. THIS MAY CAUSE ACCOUNT BAN :)
// BY RUNNING THIS SCRIPT YOU AGREED TO - FUCK AROUND AND FIND OUT.
// TERMS AND CONDITION APPLIED
(async () => {
const sleep = ms => new Promise(r => setTimeout(r, ms));
const norm = el => (el.textContent || "").replace(/\s+/g, " ").trim();
const clickAccept = () => {
const buttons = [...document.querySelectorAll("button")]
.filter(b => norm(b) === "Accept" && b.offsetParent !== null);
buttons.forEach(b => { try { b.click(); } catch (e) {} });
return buttons.length;
};
const findLoadMore = () => {
return [...document.querySelectorAll("button")]
.find(b => norm(b) === "Load more" && b.offsetParent !== null);
};
const MAX_ROUNDS = 200;
let rounds = 0;
while (rounds < MAX_ROUNDS) {
try {
let accepted = clickAccept();
let guard = 0;
while (accepted > 0 && guard < 50) {
await sleep(30);
accepted = clickAccept();
guard++;
}
window.scrollTo({ top: document.body.scrollHeight, behavior: "smooth" });
await sleep(600);
const loadMore = findLoadMore();
if (!loadMore) {
console.log(`Done after ${rounds} rounds. No more "Load more".`);
break;
}
loadMore.scrollIntoView({ behavior: "smooth", block: "center" });
await sleep(400);
loadMore.click();
rounds++;
console.log(`Load more clicked (round ${rounds})`);
await sleep(1000);
} catch (e) {
console.error(`Stopped on error at round ${rounds}:`, e);
break;
}
}
if (rounds >= MAX_ROUNDS) console.warn("Hit MAX_ROUNDS cap, stopping.");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment