Skip to content

Instantly share code, notes, and snippets.

@buzzedword
Created August 19, 2011 00:43
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save buzzedword/1155717 to your computer and use it in GitHub Desktop.
Save buzzedword/1155717 to your computer and use it in GitHub Desktop.
Scrape all friends from autocomplete on FB
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