Reputation: 6572
I am looking for a solution which I can get that last 50 comments to the page's wall, or all comments in an hour to the page's wall and posts date wont matter, could be posted 2 years before but If gets a comment in an hour I need to get it. I don't want to get all posts and look one by one.
thank you for your effort
Upvotes: 0
Views: 920
Reputation: 11852
The first one is easy. Issue an API call to this endpoint:
/PAGE_NAME_OR_ID/feed?fields=comments.limit(50)
You will be restricted to the normal limits of feed
, so the comments returned here will only be those made on the last 30 days or 50 posts, whichever is fewer.
If you want the last 50 comments, you'll need to use FQL.
SELECT time, text, text_tags, post_id FROM comment WHERE post_id IN
(SELECT post_id FROM stream WHERE source_id IN
(SELECT id FROM profile WHERE username="cocacola") LIMIT 100)
ORDER BY time DESC LIMIT 50
Keep in mind that Facebook's filtering algorithms operate after FQL. You may need to increase the LIMIT
values substantially to be guaranteed get 50 results.
Upvotes: 1