1

I am working on a script that gets the amount of likes (or comments, shares) a public facebook photo has.

The photo is posted on a page, for example: https://www.facebook.com/photo.php?fbid=10151848827816729. These are viewable to the public and so it should be possible to get the amount of likes it has via Javascript.


Note that the Facebook Graph API does not return the amount of likes it has: https://graph.facebook.com/10151848827816729

4

2 回答 2

4

2013 年 10 月 2 日的重大变更的一部分是:

“/POST_ID/likes 更新:应用程序将能够通过分页检索帖子上的所有赞(而不是现在的前 4 个)。由于功能更新,点赞数将移至汇总字段。”</p>

这也适用于您的照片,https://developers.facebook.com/tools/explorer?method=GET&path=10151848827816729%3Ffields%3Dlikes.limit(1).summary(1)为您提供

"summary": {
  "total_count": 13610
}

作为likes返回数据结构的一部分。(limit(1)因为您只对总体喜欢计数感兴趣,所以请求更多个人喜欢只会浪费带宽 -1是要获取的实际喜欢数据的最小数量,使用0将与无限制相同,并提供默认的前 25 个喜欢。)

请注意,您必须在应用设置中启用相应的迁移才能使其正常工作。

于 2013-09-28T11:20:49.273 回答
0

要仅获取照片或任何其他 FB 对象的总点赞数,您可以使用以下 FQL 查询。

FB.api({ "method": 'fql.query', "query": 'SELECT user_id FROM like WHERE object_id="' + ID OF Photo + '"' } , function(resp) { totalLikes = resp.length;咧嘴笑

Facebook 相册流中的“点赞数”错误

于 2013-09-27T23:22:58.440 回答