Created
February 17, 2020 21:48
-
-
Save Geograph-us/671f3fbc6ba6d02ddf9bad59bf9ef190 to your computer and use it in GitHub Desktop.
Get twitter followers using browser console
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
// Open twitter-followers page | |
// Open browser-console and paste this script | |
// Click on page for stop script | |
// When script done you can use global variables window.text or window.followersSet | |
// for example copy to clipboard | |
// copy(window.text); | |
var scrollTimer; | |
window.followersSet = new Set(); | |
window.text = ""; | |
window.onclick = function () | |
{ | |
// stop timer | |
clearInterval(scrollTimer); | |
// show followers in alert | |
window.text = Array.from(followersSet).join("\r\n"); | |
alert(window.text); | |
this.onclick=null; | |
} | |
scrollTimer = setInterval(()=> | |
{ | |
// find all twitter followers | |
var followers = document.querySelectorAll("a > div > div:nth-child(2) > div > span"); | |
for (var follower of followers) window.followersSet.add(follower.innerText); | |
console.log(window.followersSet.size); | |
scrollBy(0, document.body.clientHeight); | |
//scrollTo(0, document.body.scrollHeight); | |
//console.log(document.body.scrollHeight); | |
}, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment