我想从我的网站上获取所有评论。 我找到了this method in plugin FAQ:
{{1}}
但它既不对应API reference(在返回的OpenGraph对象中没有名为{{1}}的字段),也没有实际效果。所以我只设法获取大量评论,但实际上并不是他们的内容。是否可以这样做?
答案 0 :(得分:0)
常见问题解答中提到的代码似乎是针对API的v2.6,因此可能会被取代。
我从评论插件中获得以下评论。
首先,我获取了Comments Plugin在其中运行的URL的Facebook Graph ID:
https://graph.facebook.com/v2.8/?id=<<YOUR_URL>>
&access_token=<<YOUR_TOKEN>>
这会返回如下响应:
{
"og_object": {
"id": "<<OBJECT_ID>>",
"description": "<<OPENGRAPH_DESCRIPTION>>",
"title": "<<OPENGRAPH_TITLE>>",
"type": "article",
"updated_time": "2017-02-08T13:53:48+0000"
},
"share": {
"comment_count": 0,
"share_count": 0
},
"id": "<<YOUR_URL>>"
}
然后我们将该Open Graph对象ID插入其中:
https://graph.facebook.com/v2.8/<<OBJECT_ID>>/comments?summary=1
&filter=stream
&order=reverse_chronological
&access_token=<<YOUR_TOKEN>>
您将获得一个带有数据属性的对象,该属性将是一个注释数组。
https://graph.facebook.com/v2.8/
id=http://pdffiller.com/6962253&access_token=[REDACTED]
返回的
{
"og_object": {
"id": "1195506680497732",
"description": "Fill w9 fill out online 2014-2017 form irs instantly, download blank or editable online. Sign, fax and printable from PC, iPad, tablet or mobile. No software. Try Now!",
"title": "2014-2017 Form IRS W-9 Fill Online, Printable, Fillable, Blank - PDFfiller",
"type": "website",
"updated_time": "2017-02-08T12:08:37+0000"
},
"share": {
"comment_count": 0,
"share_count": 24
},
"id": "http://pdffiller.com/6962253"
}
请注意comment_count
为零,因此图谱API