Facebook Api获取Feed和评论 [英] Facebook Api getting feeds and comments

查看:89
本文介绍了Facebook Api获取Feed和评论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在公共墙壁上获取信息,并提供相关的评论。
所以每隔X分钟,我正在进行查询,以获得最新的信息(Feed和评论)。

I'm trying to get the feeds on a public wall and the associated comments. So every X minutes I'm doing a query in order to get what's new (feeds and comments).

我需要feed myDate)和评论(发布在旧的Feed上发布的新Feed和评论上的评论)。
所以如果有人发表了对旧的饲料的评论,我想得到它。
我试图使用FQL和Graph API来做到这一点,但是我没有找到最好的解决方案。

I need the feeds (the new feeds since myDate) and comments (comments posted on the new feeds and comments posted on older feeds). So if someone posted a comment on a older feed I want to get it. I tryied to do this using FQL and Graph API but I don't manage to find the best solution.

使用FQL有一些问题(错误)与LIMIT和OFFSET,并不能很好地工作。
使用Graph API,我没有这么多的权力。
所以这是我试过的:

With FQL there are some problems (bugs) with LIMIT and OFFSET and does not work very well. With the Graph API I don't have so much power. So this is what I've tryied:

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 post, so no problem because for each one I'm doing a new query in order to get the 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 posted on a older post, I don't receive it.

使用FQL我不能仅过滤最新的帖子(基于我的日期)和帖子与新的评论。

Using FQL I cannot filter only the newest posts (based on my since date) and the 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

使用Graph API我有一个很好的分页以前的链接里面的响应),但是与FQL我没有找到任何解决方案。

Using Graph API I have a good pagination (using next and previous links inside the response) but with FQL I did't find any solution.

所以有人有一些想法?
谢谢。

So anyone have some idea ? Thanks.

CC

推荐答案

首先, FQL是弃用的,因此您只需要使用 Graph API

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

我提供的解决方案是,当您已经有您需要重新检查其唯一ID的帖子,该请求会给您两次, created_time updated_time ,所以您需要检查您的 updated_time 是否已更改。

The solution that I came with, is that when you already have a post, you need to recheck the post with its unique ID, and that request gives you two times, created_time and updated_time, so you need to check if your updated_time changed.

Graph API中提供的分页仅适用于帖子,所以当帖子有新评论时,他们不会在列表中第一,你需要自己找到它们。

The pagination given in the Graph API is for only posts, so when posts have new comments, they won't come first in the list, you need to find them yourself.

- 更新 - strong>

-- UPDATE --

使用 batch_requests 实现此目的,因此您可以一次提出更多的请求。

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

这篇关于Facebook Api获取Feed和评论的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆