javascript - 获取 Facebook 页面帖子

标签 javascript facebook facebook-graph-api

我已经编写了一些 JavaScript 来获取 Facebook 页面上的所有帖子。我这样做的 URL 是这样的:

http://graph.facebook.com/cocacola/feed?limit=5&callback=facebookResponse

直到上周的某个时候,我才开始看到 oauth 错误,这工作得很好而且花花公子。

我在 Stack 上搜索了一个小时左右,看到很多其他人都在尝试这样做,但是在我对 FB 的所有请求开始返回这些 oauth 错误之后,没有人问过我。

这真的没有意义,- 我正在尝试从公司页面访问公开可用的数据。我仍然可以在没有 oauth 的情况下通过 RSS 这样做(尽管方式有限)。

无论如何,我希望有人能告诉我如何获得这些公开可用的信息,而不必经历获取应用程序 ID、授权 token 等繁琐的过程。

最佳答案

这是一个 recent not-so-recent change ,但您现在需要访问 token 才能访问 /feed/posts。很烦人,但至少可以导航。

编辑:更新了链接,该链接自这篇文章相关以来已经中断了很多年。以下是该帖子的相关文字,供后人引用:

Breaking change: Graph API PROFILE_ID/feed and PROFILE_ID/posts requires access_token

The Graph API PROFILE_ID/feed/ for a Page, Application, User or Group and PROFILE_ID/posts for a Page or User will now require a vaild [sic] access_token to access the wall or posts of the corresponding object (where previously no access_token was required). This will also affect direct FQL queries to the stream table, when querying for posts on a wall.

You will need to pass a valid app or user access_token to access this functionality. Please update your code if you are calling this API without an access token. This change will go live a week from today - Friday(June 3rd). We have updated the Roadmap to reflect this change.

Moving forward, you should always pass a valid app or user access_token with all API requests.

关于javascript - 获取 Facebook 页面帖子,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6528113/

相关文章:

ios - 如何使用 Facebook API 选择好友 ID?

ios - 我可以在新的FB对话中预先选择 friend 吗?

javascript - 如何用数组实现轮播

javascript - Fancybox form ajax提交,只有一个ajax请求

javascript - 如何从数据库异步获取数据?

javascript - 导出与定义内联或在文件末尾的 es6 默认类?

facebook - 根据用户的位置 Conceal Facebook 选项卡

mysql - Facebook 邀请 mysql 分层查询改为使用 postgresql

java - 如何使用 Selenium Webdriver 正确查找网页元素?

Android:什么是 Facebook SDK 4.x 中的共享对话框类