问题
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