如何通过 Facebook API 检索用户的完整新闻源?
我想检索给定用户的完整新闻源,包括历史数据。原则上,使用对 Graph API 或 FQL API 的经过身份验证的调用即可直接完成此操作。
通过 Graph API,我访问 me/home
端点。结果是 25 个条目。我可以迭代这些页面并检索大约 8 页回到历史记录中,从而获得大约 200 个条目。我写了大约 200 个条目,因为每次运行时我都会得到不同数量的总条目。有时多,有时少。
使用FQL API,我调用SELECT post_id,created_time,actor_id,messageFROMstreamWHEREfilter_key='nf'ANDis_hidden=0ANDcreated_time>; 1262304000 LIMIT 500
其中创建时间反映的是 2010 年 1 月 1 日。这给了我大约 150 个条目。
这两种方法似乎都不允许追溯历史。在 FQL 查询中,我还尝试使用 created_time
字段和 LIMIT
来小块地向后移动,但它不起作用。
stream
表的文档 http://developers.facebook .com/docs/reference/fql/stream/ 神秘地说:
与主页视图不同,个人资料视图返回来自我们数据库的较旧数据。
据我所知,主页视图是新闻源的另一个词,所以这可能意味着我想要的根本不可能?
更糟糕的是(但这不是这个问题的主要主题)两种方法返回的数据集不同。两者都包含对方未显示的条目,但它们也有许多共同的条目。更糟糕的是,与 Facebook 网站上的真实新闻源相比,情况也是如此。
有谁对此有任何经验或更深入的见解吗?
I would like to retrieve the full newsfeed including historical data of a given user. In principal, this is straight forward using either an authenticated call to the Graph API or to the FQL API.
With the Graph API, I access the me/home
endpoint. This results in 25 entries. I can iterate over the pages and retrieve around 8 pages back into history giving me around 200 entries. I write around 200 entries, because with each run through this I get a different number of total entries. Sometimes more, sometimes less.
With the FQL API, I call SELECT post_id, created_time, actor_id, message FROM stream WHERE filter_key = 'nf' AND is_hidden=0 AND created_time > 1262304000 LIMIT 500
where the created time reflects 1 Jan 2010. This gives me around 150 entries.
Both methods don't seem to allow to work your way backwards into history. In the FQL query, I also tried to play around with the created_time
field and LIMIT
to go backwards in small chunks but it didn't work.
The documentation of the stream
table http://developers.facebook.com/docs/reference/fql/stream/ says somehow cryptically:
The profile view, unlike the homepage view, returns older data from our databases.
Homepage view - as far as I understand - is another word for Newsfeed, so that might mean that what I want is not even possible at all?
To make things worse (but that's not the main topic of this question) the returned datasets from the two methods differ. Both contain entries that the other does not show but they also have many entries in common. Even worse, the same is true in comparison to the real newsfeed on the Facebook website.
Does anyone have any experience or deeper insights on this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许我误解了你的问题,但你不能简单地使用 /me/home?limit=5000 调用图形 api,然后调用 ?limit=5000&offset=5000 或 Facebook 允许的最大限制值吗?
Maybe I am mis-understanding your question, but can't you simply call the graph api with /me/home?limit=5000 and then ?limit=5000&offset=5000 or whatever the max limit value Facebook allows is?