Getting from Facebook API total number of likes pe

2019-08-28 02:46发布

问题:

I'm working with the following Facebook API endpoints: /statuses, /links, /photos For each returned object I'm only getting likes and comments objects which display top25 results, and a pagination that leads to the next 25.

I'm only interested in the number of likes. Is there a way to get that number through a different API call which doesn't require multiple pagination calls?

回答1:

You can return the total number of likes for various objects using FQL. Here's the documentation for how to get the total number of likes for a comment:

https://developers.facebook.com/docs/reference/fql/comment

The query itself would look like this:

SELECT likes FROM comment WHERE post_id = xyx



回答2:

SELECT like_info.like_count FROM stream WHERE source_id = '<id>'

or

SELECT like_info.like_count FROM stream WHERE source_id = '<id>' and and actor_id = '<id>'

More: https://developers.facebook.com/docs/reference/fql/stream/