Skip to content

Instantly share code, notes, and snippets.

@inazt
Created November 2, 2010 06:40
Show Gist options
  • Save inazt/659331 to your computer and use it in GitHub Desktop.
Save inazt/659331 to your computer and use it in GitHub Desktop.
FB.Event.Count.Comments
/**
* Using Graph API
**/
FB.api('/134478319934542/feed?limit=9999', function(data) {
console.log(data.data.length)
$('body').html('');
var line;
var uid;
FB.Array.forEach(data.data, function(resp) {
if(resp.likes > 20) {
uid = resp.from.id;
line = resp.likes+ ','+ resp.message+ ','+resp.created_time+ ',' + resp.from.name +',' +'http://facebook.com/profile.php?id='+uid +','+ resp.type +','+ (resp.link || 'none')
$('body').append(line).append('<br>');
}
});
})
/**
* Using FQL
**/
var qp1 = 'SELECT post_id, likes, actor_id, target_id, message FROM stream WHERE source_id = {0} ORDER BY likes.count DESC LIMIT 50';
var q1 = FB.Data.query(qp1, '134478319934542');
q1.wait(function(rows) {
console.log('max likes = ', rows[0].likes.count);
FB.Array.forEach(rows, function(post) {
console.log(post, post.likes.count );
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment