流和评论的 FQL 范围限制

发布于 2024-11-25 20:22:38 字数 1149 浏览 1 评论 0原文

我对 Facebook FQL 的工作原理感到有些困惑。我需要获取特定页面的“本月粉丝”。这是发帖和评论最多的用户。

在 facebook FQL 流文档中,它说:

流表的每次查询仅限于前30天或 50 个帖子,以较大者为准,但是您可以使用特定时间 诸如created_time之类的字段以及FQL运算符(例如<或>) 检索更大范围的帖子。

这就是我正在做的事情。我通过以下方式获得一定范围内的帖子:

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

这似乎有效 - 不知何故 - 但我在评论方面遇到问题。我不想获取特定帖子的所有评论,而是获取某个时间范围内的所有评论。

SELECT fromid, time FROM comment WHERE post_id IN (SELECT post_id FROM stream WHERE source_id = '.$wallid.')

这将返回大约 50 条评论。当我添加以下内容时:

AND time > 1309478400 // 2011-07-01

我也会收到评论。但是通过以下内容(2011-07-01 - 2011-07-02)我返回一个空数组:

AND time > 1309478400 AND time < 1309564800

当我不添加时间条件时,似乎我可以通过运行多个查询返回超过 50 条评论增加限制:

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

但是这种限制在我的时间条件下无法正常工作。

那么,是否有人已经做了类似的事情,或者有人可以解释在什么情况下这些限制有效,什么时候无效?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝礼 2024-12-02 20:22:38

FQL 将于 2015 年 4 月 30 日弃用 ---

因此,您只需使用记录的 GraphAPI 端点 这里

不幸的是,它看起来并没有让你能够按时间过滤,但你可以只迭代得到的结果,直到你得到你想要的时间范围...

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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文