3

私は自分のブログにFacebookコメントプラグインを使用していますが、これまで、FacebookグラフAPIは、自分のWebサイトの各投稿のコメント数を取得するのに役立ちました。したがって、私が言ったように、私が1か月前のように書いた投稿は、次のように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"
   }
}

「コメント」の行はもう表示されません。現在、より多くの情報があります(気にしない情報もあります)。どうしたの?コードをまったく変更しませんでした。ちなみに、私のコメントボックスはまだ機能していて、すべてのコメントを表示しています(そして、私のいいねボタンは「共有」カウントを正しく表示します)。誰かが私を助けることができますか?

4

2 に答える 2

5

私にはバグのように見えます。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エクスプローラーを試してください: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

ただし、共有数とコメント数を再び返すようにGraphAPIを変更していただければ幸いです。

この公式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/

于 2012-12-28T03:25:42.200 に答える
1

FacebookはFQLを非推奨にしました。したがって、fqlは使用しないでください。次のパスを使用して共有数を取得できます

http://graph.facebook.com/?id=http://sriraman.in/

詳細については、http://blog.sriraman.in/url-share-count-facebook-twitter/を参照してください。

于 2014-10-08T17:54:02.863 に答える