Skip to content

Instantly share code, notes, and snippets.

@masterkrang
Created September 30, 2014 15:10
Show Gist options
  • Save masterkrang/6b785fd39cb2cb828feb to your computer and use it in GitHub Desktop.
Save masterkrang/6b785fd39cb2cb828feb to your computer and use it in GitHub Desktop.
var numberOfUsers = 3000 // the nubmer of users you want to follow (it will break after about 5000)
function harvest() {
// keep scrolling the page to the bottom
$("#search").scrollTop($("#search")[0].scrollHeight);
// get all the follow buttons
var bs = $('*[data-capture="noiseClicked"]')//.length
// figure out how many follow buttons you have
var len = bs.length
// show the number of people you have on the page because you're impatient
console.log(len)
// if you have more than said number then stop harvesting
if ( len > numberOfUsers) {
} else {
// choose a random number of time for when to call harvest again, since internet speeds differ
setTimeout(harvest, Math.floor(Math.random() * 500) + 1);
}
}
// start harvesting
harvest();
var i = 0; // counter
// get all the follow buttons on the page
var buttons = $('*[data-capture="noiseClicked"]')
function follow() {
// simulate a click on the button
$(buttons[i]).trigger("click")
// show that you followed it
console.log("follow")
// increment the counter
i = i + 1
// check all the buttons have been clicked
if (i < buttons.length - 1) {
// all the buttons haven't been clicked, click more, bitch!
setTimeout(follow, 400);
}
}
// start it
follow()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment