Facebook Graph Api url评论和分享计数不再工作了 [英] Facebook Graph Api url comments and shares count doesn't work anymore

查看:159
本文介绍了Facebook Graph Api url评论和分享计数不再工作了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Facebook的评论插件,直到现在,Facebook图表api帮助我检索了我网站上每篇文章的评论数。所以,正如我所说,我一个月前写的帖子,我可以使用php和json_decode这样检索评论数:

I'm using the facebook comment plugin for my blog and until now, the facebook graph api helped me to retrieve the comment count of each post on my website. So, as I said, the posts that I've written like a month ago, I can retrieve the comment count using php and json_decode like this:

$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/

Usually, it works cause the "comments" line show up. I don't know why, but now, every new post that I create don't have the "comments" and "shares" line. So, here's what I get from 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"
   }
}

评论行不再显示,我有更多现在的信息(一些我不在乎的信息)。所以发生了什么事?我没有改变我的代码!顺便说一下,我的评论框仍然在工作,并显示所有的评论(和我的喜欢按钮正确显示分享计数)。有人可以帮助我吗?

The "comments" line doesn't show up anymore and I have more information now (some information that I don't care). So, what happened? I didn't change my code at all! By the way, my comment box is still working and display all the comments (And my like button display the "shares" count correctly). Can somebody help me?

推荐答案

看起来像是一个错误。 FQL查询是一种仍然可行的选择。以下是一个例子:

Looks like a bug to me. FQL Query is an alternative that still works. Here's an example:

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资源管理器: 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-意见,现在已经上过50K-网站-GET-更多的社交与 - 最新升级%2F%22

Try the API Explorer here: 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以返回股票数量和评论数量,我会很乐意

However I would love it if they changed the Graph API to return share counts and comment counts again.

此官方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/

This official Facebook doc (developers.facebook.com/docs/reference/plugins/comments/) still recommends using the Graph API for comment counts, however it does not seem to work with new pages like this one: https://graph.facebook.com/?ids=http://techcrunch.com/2012/12/27/the-last-imac-question-mark/

这篇关于Facebook Graph Api url评论和分享计数不再工作了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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