Facebook FQL. Which is the easiest way to get all page changes in one single query ordered by date/time?

流过昼夜 提交于 2019-12-13 08:28:24

问题


I need to monitor one single page and all related activities. This is the result I'm trying to accomplish:

29/10 - User: John - Action: Like    - Object type: status - Object id: 123456
29/10 - User: Mary - Action: Comment - Object type: status - Object id: 123343
29/10 - User: Etan - Action: Tagged  - Object type: status - Object id: 123537
29/10 - User: Arth - Action: Like    - Object type: status - Object id: 123876
29/10 - User: Jack - Action: Post    - Object type: status - Object id: 123423
29/10 - User: Jack - Action: Photo   - Object type: photo - Object id: 123423

You can take as example the search by term, that provide everything as expected. We have in one single call comments, posts, statuses and photos ordered since the specified date/time:

https://graph.facebook.com/search?q=watermelon&type=post

Since there's no way to do it simple as the /search?q=, how can I do it with FQL?

Should I use the stream table? In that case, which filter of the stream_table should I apply?

Is there an easy way to do that or do I have to get every thing in separated queries?

(If it helps: I'm using Facebook PHP SDK)


回答1:


We are also using this technique but there is still an issue. The stream table returns the Top Posts view of the feed and not the Most recent one EVEN if you specify an ORDER BY updated_time DESC.

So you might miss posts, especially posts from fans. We have not found a solution to this problem...




回答2:


I ran into the same problem recently. Initially I thought that the feed connection of a page will be what I need, but it turns out that if you sort with since or until it will look at a post's created_at attribute. This means that comments on older posts won't show up.

The best solution I could find is to first do a FQL query on the stream table to get the post ids:

SELECT post_id FROM stream WHERE source_id = {PAGE_ID} AND updated_time > {TIME}

and then simply get all the posts at once:

https://graph.facebook.com?ids=ID1,ID2,ID3...


来源:https://stackoverflow.com/questions/7942771/facebook-fql-which-is-the-easiest-way-to-get-all-page-changes-in-one-single-que

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!