Facebook图谱API中的URL评论和分享计数不再起作用。

3
我正在使用Facebook评论插件来为我的博客提供评论功能,直到现在,Facebook图形API帮助我检索网站上每篇文章的评论计数。因此,就像我所说的那样,我可以使用PHP和json_decode来检索一个月前发布的文章的评论计数:
$wsurl  = 'http://www.example.com/title-of-the-post/';
$wsjson = json_decode(file_get_contents('https://graph.facebook.com/?ids='.$wsurl));
$cmcount = ($wsjson->$wsurl->comments) ? $wsjson->$wsurl->comments : 0;

通常情况下,因为“评论”行出现而起作用。我不知道为什么,但现在,我创建的每篇新文章都没有“评论”和“分享”行。所以,这是我从https://graph.facebook.com/?ids=http://www.example.com/title-of-the-post/得到的。
旧文章:
{
   "http://www.example.com/title-of-the-post/": {
      "id": "http://www.example.com/title-of-the-post/",
      "shares": 6,
      "comments": 6
   }
}

新文章:
{
   "http://www.example.com/title-of-the-post/": {
      "url": "http://www.example.com/title-of-the-post/",
      "type": "website",
      "title": "Title of the post",
      "image": [
         {
            "url": "http://www.example.com/thumb.png"
         }
      ],
      "description": "This is a great post about great things.",
      "updated_time": "2012-12-25T17:57:03+0000",
      "id": "66666666666666"
   }
}

“评论”一行不再显示,现在我有更多的信息(一些我不关心的信息)。那么,发生了什么?我根本没有改变我的代码!顺便说一句,我的评论框仍然可以工作,并显示所有的评论(我的点赞按钮正确地显示了“分享”计数)。有人能帮我吗?
2个回答

5

看起来对我来说是个bug。FQL查询是一种仍然有效的替代方法。这是一个例子:

select comment_count, share_count, like_count from link_stat where url = "http://techcrunch.com/2011/04/12/facebook-comments-now-on-over-50k-sites-get-more-social-with-latest-upgrade/"

在这里尝试API Explorer:http://developers.facebook.com/tools/explorer/?fql=select%20comment_count%2C%20share_count%2C%20like_count%20from%20link_stat%20where%20url%20%3D%20%22http%3A%2F%2Ftechcrunch.com%2F2011%2F04%2F12%2Ffacebook-comments-now-on-over-50k-sites-get-more-social-with-latest-upgrade%2F%22

不过,如果他们能够将Graph API更改为再次返回分享计数和评论计数,那就太好了。

这份官方Facebook文档(developers.facebook.com/docs/reference/plugins/comments/)仍然建议使用Graph API来获取评论计数,但是对于像这样的新页面,它似乎无法使用:https://graph.facebook.com/?ids=http://techcrunch.com/2012/12/27/the-last-imac-question-mark/


1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接