从网站获取嵌入的Facebook评论 [英] Getting embbeded Facebook comments from site

查看:49
本文介绍了从网站获取嵌入的Facebook评论的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从网页上获取嵌入的Facebook评论:

I would like to retrieve the embedded Facebook comments from the page web:

(( http://www.example.com/sub_page_wFBcomments )

我可以使用Facebook图形API直接从facebook.com检索Facebook评论.当评论嵌入在Facebook页面所有者的网站中时,情况并非如此.

I can use the Facebook graph API for retrieving facebook comments directly from facebook.com. The same is not true when the comments are embedded in the web site of the facebook page's owner.

在使用这种图形API时:

When using the graph API like this:

https://graph.facebook.com/v2.7/[apikey]/?key = value& access_token = [MyToken]

    {
       "link": "http://www.example.con/",
       "name": "Example.com",
       "namespace": "examplecom",
       "id": "[apikey]"
    }

当天真地适应注释时:[link] https://graph.facebook.com/v2.7/[apikey]/posts/?key = value& access_token = [MyToken]

And when naively adapting to the comments: [link] https://graph.facebook.com/v2.7/[apikey]/posts/?key=value&access_token=[MyToken]

它不起作用,我得到:

 "message": "(#100) Tried accessing nonexisting field (posts) on node type (Application)",
 "type": "OAuthException",

facebook页面上没有可显示的评论/帖子.(但是,当执行[apikey] = walmart时,它会下载Facebook页面的评论)因此,我推断出缺少的东西:api如何知道在哪里查找注释?

The facebook page has no comments/posts to show. (But when doing [apikey] = walmart, it downloads the comments of the facebook page) So I deduced something is missing: how the api would know where to look for the comments ?

Stackoverflow建议使用类似/comments/?ids =页面链接" 这不起作用:

Stackoverflow suggested to use something like /comments/?ids= "link of page" which does not work:

https://graph.facebook.com/v2.7/[apikey] /comments/?ids = http://www.example.com/sub_page_wFBcomments&access_token = [MyToken]

https://graph.facebook.com/v2.7/[apikey] /comments/?ids=http://www.example.com/sub_page_wFBcomments&access_token=[MyToken]

"message":(#100)尝试访问节点类型(应用程序)上不存在的字段(注释)",

备注从先前的网址中删除"/coments"时,我在.json中恢复了正文,但没有注释.

remark When removing "/coments" from the previous url I recover the body in a .json, but not the comments.

是否可以使api在其中查找注释? http://www.example.com/sub_page_wFBcomments (而不是来自www.facebook.com/exemplecom)

Is it possible to make the api to look for the comments in ? http://www.example.com/sub_page_wFBcomments (and not from www.facebook.com/exemplecom)

感谢您的帮助.

在@CBroe注释之后,我尝试了示例中的FAQ

Following the @CBroe remark, I've tried the FAQ on the example

http://www.oneminuteinfo.com/2015/06/how-to-use-fb-api-to-get-fan-page-posts.html

    https://graph.facebook.com/v2.6/?fields=og_object{comments}&id=http://www.url.com&access_token=[MyToken]

    {
      "og_object": {
         "id": "1305277432850801"
      },
       "id": "http://www.oneminuteinfo.com/2015/06/how-to-use-fb-api-to-get-fan-page-posts.html"
    }

缺少评论:(

感谢答案@TomSanders.我尝试了您的建议,但仍然无法正常工作,我使用url检索到的ID并非给出评论的ID,我向自己解释:

Thanks for the answer @TomSanders. I tried your suggestion, and it is still not working, the id I retrieved using the url is not the one that gives the comments, I explain myself:

来自

https://graph.facebook.com/v2.3/[myUrl]/comments?limit = 100& access_token = [myToken]

我得到:

{
   "og_object": {
      "id": "813606582071724",
      "description": "the description",
      "title": "the title",
      "type": "website",
      "updated_time": "2016-10-15T16:57:59+0000"
   },
   "share": {
      "comment_count": 0,
      "share_count": 0
   },
   "id": "myUrl"
}

注释1 ,当将网址从http更改为https时,"comment_count"变为= 141.

Remark 1 when changing the url address from http to https the "comment_count" becomes = 141.

注释2 ,使用此请求在下一步中获得的ID,我检索了一个空数据:{"data":[]}.

Remark 2 using the id this request got in the next step I retrieve an empty data: {"data":[]}.

备注3(!!),当我右键单击网站的facebook插件时,我通过寻找targetid = 1065663070140433获得了Facebook ID.然后,当我将其插入api时,得到(一些)评论!

Remark 3 (!!) when right-clicking on the facebook plugin of the website I carn get the facebook id by looking for targetid = 1065663070140433. Then, when I plug it in the api I get (some of the) comments!

我在这里做错了什么?我需要灯.

What am I doing wrong here? I need lights.

推荐答案

要获取通过json调用的json的Facebook插件注释,请执行以下操作:

To get facebook plugin comments by json you call by this url:

https://graph.facebook.com/v7.0/?id=[your url here]&fields=og_object{comments{message,from{name,%20picture}}}

用您的网址替换 [此处的网址] .

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆