Skip to content

Instantly share code, notes, and snippets.

@PseudoSky
Created October 8, 2016 01:41
Show Gist options
  • Save PseudoSky/ea325b618237aba15f840a8f441a7004 to your computer and use it in GitHub Desktop.
Save PseudoSky/ea325b618237aba15f840a8f441a7004 to your computer and use it in GitHub Desktop.
Facebook Graph API Crawl (throttled)
function store(url,v){
window.localStorage[url]=v;
}
var query= _.throttle(function getPage(url){
$http.get(url).then( d => {
store(url,JSON.stringify(d));
if(d.data.paging && d.data.paging.next){
getPage(d.data.paging.next);
}
}
)
}, 1500);
query('https://graph.facebook.com/v2.3/1496409335/inbox?limit=25&format=json&access_token=******');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment