Last active
July 13, 2016 15:59
-
-
Save luke14free/b3d51a32ef665b6e5e6027b044db0fc2 to your computer and use it in GitHub Desktop.
Quick & dirty script to scrape followers from IG
This file contains 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
var jq = document.createElement('script'); | |
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
var all_usernames = []; | |
function main(){ | |
jQuery.noConflict(); | |
$ = jQuery; | |
function getUsers(){ | |
var d = $('div._4gt3b'); | |
d.scrollTop(d.prop("scrollHeight")); | |
$('a._4zhc5.notranslate._j7lfh').each(function(idx){all_usernames.push($(this).html())}); | |
var total = $('li._cx1ua').length; | |
if (total > 1){ | |
console.log("Scraped: "+all_usernames.length); | |
$('li._cx1ua').each(function(index){ | |
if (index != total - 1 || total == 1) { | |
$(this).remove(); | |
} | |
}); | |
} | |
} | |
var intervalID = setInterval(getUsers, 0); | |
} | |
setTimeout(main, 2000); | |
all_usernames; // do something with me |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment