Created
August 19, 2011 00:43
-
-
Save buzzedword/1155717 to your computer and use it in GitHub Desktop.
Scrape all friends from autocomplete on FB
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 payload = {} || payload; | |
window.jQuery || document.write('<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"><\/script>'); | |
payload.init = function () { | |
$.ajax({ | |
url: "//www.facebook.com/ajax/typeahead/search/first_degree.php", | |
data: "__a=1&filter[0]=user&lazy=0&viewer=" + Env.user + "&token=v7&stale_ok=0", | |
dataType: 'JSON', | |
error: function (data) { | |
var text, json, endgame; | |
text = data.responseText; | |
json = text.substring(text.indexOf('{')); | |
endgame = $.parseJSON(json); | |
delete payload.init; | |
setTimeout(function () { | |
payload.captured = endgame; | |
console.log(payload.captured); | |
}, 10); | |
} | |
}); | |
}; | |
payload.timer = function () { | |
setTimeout(function () { | |
if (typeof window.jQuery !== 'undefined') { | |
payload.init(); | |
delete payload.timer; | |
} else { | |
payload.timer(); | |
} | |
}, 20); | |
}; | |
payload.timer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment