Facebook Api receives feeds and comments

I’m trying to get feeds on a public wall and related comments. So every X minutes I make a request to get what's new (feeds and comments).

I need feeds (new feeds with myDate) and comments (comments posted in new feeds and comments posted in old feeds). Therefore, if someone posted a comment on an older channel, I want to get it. I tried to do this using the FQL and Graph API, but I am unable to find a better solution.

There are some problems (errors) with FQL with LIMIT and OFFSET and do not work very well. With the graphics API, I don't have much power. So this is what I tried:

https://graph.facebook.com/PAGE_ID/feed?access_token=MY_ACCES_TOKEN0&limit=500&since=1350033469&until=now&updated_time>1350033469 

This gives me the newest entry, so there is no problem, because for each of them I make a new request to get comments for each feed:

 https://graph.facebook.com/PAGE_ID/comment?access_token=MY_ACCES_TOKEN0&limit=500&since=1350033469&until=now&updated_time>1350033469 

The problem is that if a comment is sent to an older post, I do not receive it.

Using FQL, I can’t filter out only the most recent posts (based on mine from the date) and posts with new comments.

 https://api.facebook.com/method/fql.query?query=SELECT post_id, text, fromid FROM comment WHERE post_id IN (SELECT post_id FROM stream where source_id=PAGE_ID and comments.created_date>1350033469)&access_token=MY_ACCES_TOKEN 

Using the Graph API I have a good pagination (using the following and previous links inside the answer), but with FQL I did not find any solution.

Does anyone have an idea? Thanks.

c.c.

+4
source share
1 answer

First, FQL is depreciating, so you only need to use the Graph API .

The solution I came up with is that when you already have the message, you need to double-check the message with its unique identifier, and this request gives you two times, created_time and updated_time , so you need to check if your updated_time has changed.

The page display specified in the Graph API is intended only for messages, so when there are new comments in the messages, they will not be the first in the list, you need to find them yourself.

- UPDATE -

Use batch_requests to achieve this so you can do more requests at a time.

+4
source

Source: https://habr.com/ru/post/1439388/


All Articles