如何从评论社交插件获取评论?
我尝试使用 graph api 询问很多事情,但没有一个返回评论。 我想获取所有评论,并放入一个单独的页面供搜索引擎扫描和索引。 评论很丰富很全我想要
I tried with graph api asked many things to there but none of them are returns comments.
I want to get all comments, and put in a separate page for search engines to scan and index.
comments are very rich full and I want them
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以通过以下 api url 从评论插件中检索评论(实际上是帖子及其评论):
https://graph.facebook.com/comments/?ids={$url_of_your_page}
You can retreive comments (actually posts and their comments) from the Comments plugin from this api url:
https://graph.facebook.com/comments/?ids={$url_of_your_page}
请参阅此处的文档: http://developers.facebook.com/docs/reference/fql/
您需要查询的表在这里:
http://developers. facebook.com/docs/reference/fql/comment/
(它也是第一个示例)
关键是您可以为嵌入的每个评论插件指定一个标识符。使用此标识符,您可以使用图形 API 选择评论。
关于搜索引擎,您不应该给人留下这样的印象:您向蜘蛛提供的内容与向用户提供的内容不同,因此默认情况下通过 api 加载评论(请缓存它们),然后将其替换为javascript 框(如果 javascript 可用),以便用户可以撰写新评论。
更好的(在我看来)是始终在您的网站中以 html 形式显示评论,并且仅在用户想要发表新评论时才加载 facebook 评论插件。但这可能需要用户执行一个额外的步骤。
您还可以了解ajax 抓取方案
please see the documentation here: http://developers.facebook.com/docs/reference/fql/
the table you need to query is this here:
http://developers.facebook.com/docs/reference/fql/comment/
(it is also one of the first examples)
the key is that you can specify an identifier for every comment plugin that you embed. using this identifier you can then select comments using the graph api.
regarding search engines you should not make the impression that you are serving different content to the spiders than to the users so it would probably be a good idea to load the comments over the api by default (please cache them) and then replace it by the javascript box if javascript is available, so the users can write new comments.
even better (in my opinion) would be always to display the comments in html in your website and only load the facebook comments plugin if the user wants to make a new comment. but that probably requires one additional step for the user.
you can also read about the ajax chrawling scheme
如果您想使用图形 API,您要做的就是获取 json 中的评论 ID(您看到的第一个数字,它显示为 {user_id}_{status_message_ID} 示例:1234_5678910),然后使用 https://graph.facebook.com/{您获得的号码}?access_token={访问令牌}
尽您所能减轻压力运行您所做的系统,将所有状态消息和注释放到您的网站上(例如“foreach”或“while”语句等),然后添加一个“if”语句来说明 if count(在 json 的注释下) ) 大于 3,它将使用 id 检索该帖子的 json 并吐出您的数据。
我希望这对您有所帮助。如果您需要进一步解释,请说明。
问候,
乔恩
If you want to use the graph API what you do is grab the comment ID in the json (the very first number you see and it appears as {user_id}_{status_message_ID} example: 1234_5678910) and then have https://graph.facebook.com/{the number you got}?access_token={access token}
Do reduce strain what you could do is run the system that you do to put all the status messages and comments onto your website (for instance a 'for each' or 'while' statements etc) then add an 'if' statement that says if count (under comments on the json) is more than 3 it'll retrieve the json for that post using the id and spit out your data.
I hope this was of some help. Please say if you want anything explained further.
Regards,
Jon
您可以使用此网址获取网址的评论并对它们进行分页:
?fields=og_object{comments.order(reverse_chronological).limit (10).after(NgZDZD)}&id={YOUR_URL}
即使它适用于最新(v2.10)图表版本。
You can use this url to get comments of an url and paginate them:
?fields=og_object{comments.order(reverse_chronological).limit(10).after(NgZDZD)}&id={YOUR_URL}
Even It works with latest(v2.10) graph version.