2

I wanted to get the list of Facebook comments on a url. For example I have the url "http://example.com/37" Through graph API explorer I only needed this url as the parameter "https://graph.facebook.com/comments/?ids=http:example.com/35." How can I do this using the Koala gem?

Thanks,

4

2 回答 2

2

为了澄清前面的答案......考拉的文档指出 get_comments_for_urls 方法fetches the comments from fb:comments widgets for a given set of URLs (array or comma-separated string)。因此,当页面上有一个实际的 Facebook 评论框时,此调用有效(此处描述:https ://developers.facebook.com/docs/reference/plugins/comments/ )。

这是一个带有真实 URL 的工作示例:

oauth            = Koala::Facebook::OAuth.new Facebook::APP_ID, Facebook::SECRET
app_access_token = oauth.get_app_access_token
graph            = Koala::Facebook::API.new app_access_token
urls             = ['http://www.ruhanirabin.com/easy-steps-to-facebook-connect-comment-box-how-to/']
comments         = graph.get_comments_for_urls(urls)

请注意,应用访问令牌与您在 Facebook 开发者网站上的应用配置中指定的应用 ID 和密码不同。

于 2013-03-06T16:01:21.973 回答
1

我认为 Koala 并没有让它尽可能直观,因为它需要一个访问令牌——不像直接访问 Graph API。此外,它似乎需要一组 URL。

urls     = ["http://example.com/37"]
graph    = Koala::Facebook::GraphAPI.new(some_access_token)
comments = graph.get_comments_for_urls(urls)
于 2011-09-22T23:51:57.073 回答