更新 - 2015 年 4 月:
如果您想获取 Like 按钮中可用的计数,您应该使用 og_object 对象中的 engagement 字段,如下所示:
https://graph.facebook.com/v2.2/?id=http://www.MY-LINK.com&fields=og_object{engagement}&access_token=<access_token>
结果:
{
"og_object": {
"engagement": {
"count": 93,
"social_sentence": "93 people like this."
},
"id": "801998203216179"
},
"id": "http://techcrunch.com/2015/04/06/they-should-have-announced-at-420/"
}
可以使用 Graph API,只需使用:
http://graph.facebook.com/?id=YOUR_URL
类似:
http://graph.facebook.com/?id=http://www.google.com
会返回:
{
"id": "http://www.google.com",
"shares": 1163912
}
更新: 虽然上面将回答如何获得 share 计数。该数字不等于您在Like Button 上看到的数字,因为该数字是以下各项的总和:
- 此网址的点赞数
- 此 URL 的共享数量(包括复制/粘贴回 Facebook 的链接)
- Facebook 上有关此 URL 的故事的点赞数和 CMET 数
- 包含此 URL 作为附件的收件箱邮件数。
因此,可以使用 Graph API 通过fql 端点(link_stat 表)获取 Like Button 编号:
https://graph.facebook.com/fql?q=SELECT url, normalized_url, share_count, like_count, comment_count, total_count,commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url='http://www.google.com'
total_count 是点赞按钮中显示的数字。