Last active
April 19, 2023 03:21
-
-
Save laiso/c85749127685cdd218d4482921e2531f to your computer and use it in GitHub Desktop.
Batch follow from Twitter List https://twitter.com/i/lists/{id}/members
This file contains hidden or 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
// 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