Skip to content

Instantly share code, notes, and snippets.

@luke14free
Last active July 13, 2016 15:59
Show Gist options
  • Save luke14free/b3d51a32ef665b6e5e6027b044db0fc2 to your computer and use it in GitHub Desktop.
Save luke14free/b3d51a32ef665b6e5e6027b044db0fc2 to your computer and use it in GitHub Desktop.
Quick & dirty script to scrape followers from IG
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