开发者

FQL range limitations for stream and comments

开发者 https://www.devze.com 2023-03-22 02:01 出处:网络
I\'m somehow confused about how the Facebook FQL works. I need to get the \"fan of the month\" of a specific page. That is a user who did the most posts and comments.

I'm somehow confused about how the Facebook FQL works. I need to get the "fan of the month" of a specific page. That is a user who did the most posts and comments.

In the facebook FQL stream documentation it says:

Each query of the stream table is limited to the previous 30 days or 50 posts, whichever is greater, however you can use time-specific fields such as created_time along with FQL operators (such as < or >) to retrieve a much greater range of posts.

And that's what I'm doing. I am getting the posts within a certain range the following way:

SELECT actor_id,created_time FROM stream WHERE source_id = '.$wallid.' AND (created_time >= '.$date_start.' OR updated_time >= '.$date_start.')'

This seems to work - somehow - but I'm having problems with comments. I don't want to get all comments for a specific post but all comments within a time range.

SELECT fromid, time FROM comment WHERE post_id IN (SELECT post_id FROM stream WHERE source_id = '.$wallid.')
开发者_如何转开发

That will return about 50 comments. When I add the following:

AND time > 1309478400 // 2011-07-01

I also get comments. BUT with the following (2011-07-01 - 2011-07-02) I get back an empty array:

AND time > 1309478400 AND time < 1309564800

When I don't add the time conditions, it seems as if I could get back more than 50 comments by running several queries with incrementing limitation:

... LIMIT 0, 50
... LIMIT 50, 50

But this limitations won't work properly with my time condition.

So, has anyone already made something similar or can anybody explain under which circumstances the limitations work and when not?


FQL will be deprecated by April 30th, 2015 ---

So, you'll want to simply use the GraphAPI endpoint documented here

Unfortunately, it doesn't look like it gives you the ability to filter by time, but you could just take the results you get an iterate through them until you get the time-frame you want...

0

精彩评论

暂无评论...
验证码 换一张
取 消