我曾经通过以下方式从 Facebook 获取我的网页的点赞数:
http://api.facebook.com/restserver.php?method=links.getStats&format=json&urls=www.example.com
但这不再起作用了。
我尝试过:
https://graph.facebook.com/fql?q=SELECT%20total_count%20FROM%20link_stat%20WHERE%20url=%22www.example.com%22
但这也行不通。
我尝试过:
http://graph.facebook.com/?ids=http%3a%2f%2fwww.example.com
但这只给了我 share_count,而不是喜欢的数量。
我发现了这个:https://developers.facebook.com/docs/graph-api/reference/v2.7/object/likes
发布 graph.facebook.com/v2.7/{object-id}/likes HTTP/1.1
但我不知道 {object-id} 是什么或者在哪里可以得到它。我不知道是否需要任何访问凭据才能访问这些信息。
有人有一个小例子,我现在需要什么http请求才能获得我的网页的喜欢吗?
最佳答案
接收分享/评论数量和对象 ID
graph.facebook.com/?fields=og_object{id},share&id=https://stackoverflow.com/
保存分享/评论计数
保存 url 的 Facebook object-id
og_object->id
获取点赞数(最大限制为 1000,然后您可以使用分页):
graph.facebook.com/OBJECT_ID/likes?access_token=ACCESS_TOKEN&pretty=1&limit=1000
更新2016-08-22
我找到了一种解决方案,可以让您一步获得点赞/转发/评论的数量:
https://graph.facebook.com/?fields=og_object{likes.limit(0).summary(true)},share&ids=http://google.com,http://twitter.com
关于facebook - 从 Facebook 获取网页的点赞数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39026229/