Getting Comments of a URL

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,


To clarify the previous answer a bit... Koala's documentation states that the get_comments_for_urls method fetches the comments from fb:comments widgets for a given set of URLs (array or comma-separated string) . So this call works when there is an actual Facebook Comment Box on the page (described here: https://developers.facebook.com/docs/reference/plugins/comments/).

Here's a working example with a real 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)

Note that the app access token is different from the app id and secret specified in your app configuration on Facebook's developer site.


I think Koala doesn't make this as intuitive as possible, because it requires an access token - unlike accessing the Graph API directly. Also, it seems to require an array of URLs.

urls     = ["http://example.com/37"]
graph    = Koala::Facebook::GraphAPI.new(some_access_token)
comments = graph.get_comments_for_urls(urls)
链接地址: http://www.djcxy.com/p/32662.html

上一篇: 考拉Facebook事件api

下一篇: 获取URL的评论