Facebook Graph API. How to get likes for comment?

主宰稳场 提交于 2019-12-23 19:38:05

问题


I need to get ids of people who liked some comment.

For example, I have the post with id 246595548763188_464132103676197 , and this post has comment with id 464146663674741.

Then, I use Graph Api Explorer (https://developers.facebook.com/tools/explorer/)

Permissions: user_groups

Graph API URL: https://graph.facebook.com/464146663674741

Result:

{
  "id": "464146663674741", 
  "from": {
    "name": "Rostyslav Paranko", 
    "id": "100001288191932"
  }, 
  "message": "Українську мову доконають пуристи.", 
  "can_remove": false, 
  "created_time": "2013-06-03T19:10:57+0000", 
  "like_count": 8, 
  "user_likes": false
}

As you can see, like_count has value 8, but I can't see people who liked this comment (with ids and names). https://graph.facebook.com/464146663674741/likes returns empty array.

So, is it possible to get comment's likes using Graph API (or, maybe, FQL Query)?


回答1:


Get the comment ID and make this Graph API request:

https://graph.facebook.com/COMMENT_ID?fields=likes

The comment ID is in fact the concatenation of:

  • the POST_ID (246595548763188_464132103676197),
  • the COMMENT_ID (464146663674741),

which would give in your case: 246595548763188_464132103676197_464146663674741.

So, this should work:

graph.facebook.com/246595548763188_464132103676197_464146663674741?fields=likes



来源:https://stackoverflow.com/questions/16955653/facebook-graph-api-how-to-get-likes-for-comment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!