我想获得的一个URL Facebook的评论列表。例如,我有URL“http://example.com/37”通过图形API的探险家,我只需要将该URL参数“https://graph.facebook.com/comments/?ids=http:example.com/35“。我如何使用考拉宝石来做到这一点?获得一个网址的评论 - 考拉图形API
感谢,
我想获得的一个URL Facebook的评论列表。例如,我有URL“http://example.com/37”通过图形API的探险家,我只需要将该URL参数“https://graph.facebook.com/comments/?ids=http:example.com/35“。我如何使用考拉宝石来做到这一点?获得一个网址的评论 - 考拉图形API
感谢,
我觉得考拉不使这一尽可能直观,因为它需要一个访问令牌 - 不像直接访问图形API。另外,它似乎需要一组URL。
urls = ["http://example.com/37"]
graph = Koala::Facebook::GraphAPI.new(some_access_token)
comments = graph.get_comments_for_urls(urls)
为了澄清以前的答案有点...考拉的文档指出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)
请注意,App访问令牌是从应用程序ID不同,秘密Facebook的开发者网站应用程式设定中指定。