Skip to content

Instantly share code, notes, and snippets.

@laiso
Last active April 19, 2023 03:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laiso/c85749127685cdd218d4482921e2531f to your computer and use it in GitHub Desktop.
Save laiso/c85749127685cdd218d4482921e2531f to your computer and use it in GitHub Desktop.
Batch follow from Twitter List https://twitter.com/i/lists/{id}/members
// Step 1
let nodes = Array.from(document.querySelectorAll('span span:not(:empty)')).filter(d => d.textContent != 'Remove');
for (const node of nodes) {
node.dispatchEvent( new MouseEvent('mouseover', {
bubbles: true,
cancelable: true,
view: window
}));
}
// Step 2
nodes = Array.from(document.querySelectorAll('[aria-label^="Follow @"]'));
let index = 0;
function followUser() {
if (index >= nodes.length || index >= 30) {
clearInterval(interval);
return;
}
nodes[index].dispatchEvent(new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window
}));
index++;
}
const SLEEP = 2000; // Set the desired interval between following users in milliseconds (2000 ms = 2 seconds)
let interval = setInterval(followUser, SLEEP);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment