Facebook Graph API:如何过滤主页和主页按应用程序馈送?
Facebook Graph API 可让您获取主页(新闻源)和主页的 JSON 表示形式。饲料(墙)。
如何获取 Facebook 应用程序发布的帖子?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
Facebook Graph API 可让您获取主页(新闻源)和主页的 JSON 表示形式。饲料(墙)。
如何获取 Facebook 应用程序发布的帖子?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(3)
Facebook 添加了对过滤
me/home
帖子的支持,无需使用 FQL,只需传递filter
参数即可。例如,要仅获取照片,您可以执行以下操作:
me/home?filter=app_2305272732
完整文档位于:http:// Developers.facebook.com/docs/reference/api/user/#home
Facebook has added support to filter
me/home
posts without using FQL by passing thefilter
parameter.For example to get just photos you can do:
me/home?filter=app_2305272732
Full documentation is here: http://developers.facebook.com/docs/reference/api/user/#home
您现在可以使用 Facebook 查询语言 (FQL) 查询“https://developers.facebook.com/docs/reference/api/” rel="nofollow noreferrer">Facebook Graph API(基本 URL:
https://graph.facebook.com)。
假设您的应用程序是 Twitter。 Twitter 的 Facebook 应用程序 ID 是 2231777543。
我在 @danontheline 的回答并仔细阅读 Facebook 的文档 FQL 流 & FQLstream_filter。
以下摘录特别相关:
Facebook 新闻源上的 Twitter 推文
Facebook 墙上的 Twitter 推文
使用 Facebook Graph API Explorer 返回 Facebook Graph API post 对象(结果集会有所不同,具体取决于在
access_token
、隐私等)。您可以通过将流表的其他列添加到上面的查询中和/或简单地向每个post_id< 的
GET /{post_id}
发出另一个 Graph API 请求来了解有关每个帖子的更多信息。 /code> 由上面的 FQL 流查询返回。You can now run Facebook Query Language (FQL) queries using the Facebook Graph API (base URL:
https://graph.facebook.com
).Let's say your application is Twitter. Twitter's Facebook application ID is 2231777543.
I came up with the FQL queries below with the help of @danontheline's answer and by carefully reading Facebook's documentation on FQL stream & FQL stream_filter.
The following excerpt is particularly pertinent:
Twitter Tweets on Your Facebook News Feed
Twitter Tweets on Your Facebook Wall
Running these queries with the Facebook Graph API Explorer returns Facebook Graph API post objects (The result set will differ depending on
access_token
, privacy, etc.). You can find out more about each post by adding other columns of the stream table to the queries above and/or by simply making another Graph API request toGET /{post_id}
for eachepost_id
returned by the FQL stream queries above.老实说,仅使用 Graph API 是不可能实现这一点的。但是您也可以使用 FQL 语句来检索墙/提要。通过这种技术,您可以将其限制为由一个 actor_id(在本例中应该是您的应用程序 ID)发布的帖子:
这里的问题是它不会返回 JSON,而是返回结果的 XML 表示形式。使用 phps DOM 类,您可以轻松地将其转换为 JSON 格式或您想要的结果的任何其他表示!
由于您可能会使用 PHP 处理整个事情,因此您也可以只获取 json 数组,将其解析为数组并使用 appID 的键过滤该数组。
Afaik thats not possible with just the Graph API. But you can just use a FQL statement to retrieve the wall/feed, too. With this technique you are able to resrict it to the posts made by one actor_id (which should be your app ID in this case):
Thing here is that it won't return a JSON, but a XML representation of the result. With phps DOM class you are easily able to convert it into a JSON format or any other representation you want to have of the result!
As you might be handling the whole thing with PHP anyway, you also could just take the json array, parse it into an array and filter the array with keys of your appID.