PHP SDKと非推奨のREST APIを使用してURLの共有数を取得できますが、グラフAPIを使用してURLの共有数を取得する方法が見つかりませんでした。
調べる方法はありますか?
PHP SDKと非推奨のREST APIを使用してURLの共有数を取得できますが、グラフAPIを使用してURLの共有数を取得する方法が見つかりませんでした。
調べる方法はありますか?
回答:
統計を取得するためのAPIリンクのリストは次のとおりです。
Facebook: https
: //api.facebook.com/method/links.getStats ? urls = %% URL %% & format = json Reddit:http : //buttons.reddit.com/button_info.json ? url = %% URL % %
LinkedIn:http : //www.linkedin.com/countserv/count/share?
url = %% URL %%&format = json Digg:http : //widgets.digg.com/buttons/count ? url = %% URL %%
おいしい:http : //feeds.delicious.com/v2/json/urlinfo/data ? url= %% URL %%
StumbleUpon:http : //www.stumbleupon.com/services/1.01/badge.getinfo? url = %% URL %%
Pinterest:http ://widgets.pinterest.com/v1/urls/count.json ? source =6&url=%%URL%%
編集:Twitterエンドポイントは廃止されたため、削除しました。
編集:Facebook REST APIは廃止予定
更新-2015年4月:
[いいね!]ボタンで利用できるカウントを取得するには、次のようにオブジェクトのengagementフィールドを使用する必要がありog_objectます。
https://graph.facebook.com/v2.2/?id=http://www.MY-LINK.com&fields=og_object{engagement}&access_token=<access_token>
結果:
{
  "og_object": {
    "engagement": {
      "count": 93, 
      "social_sentence": "93 people like this."
    }, 
    "id": "801998203216179"
  }, 
  "id": "http://techcrunch.com/2015/04/06/they-should-have-announced-at-420/"
}
グラフAPIで可能です。次のように使用します。
http://graph.facebook.com/?id=YOUR_URL
何かのようなもの:
http://graph.facebook.com/?id=http://www.google.com
戻ります:
{
   "id": "http://www.google.com",
   "shares": 1163912
}
更新:上記は共有数を取得する方法に答えます。この番号はありませんあなたが上で見るものに等しいのLikeボタンその数は合計であるため、:
したがって、fqlエンドポイント(link_stat表)を介してGraph APIでLikeボタン番号を取得することが可能です。  
https://graph.facebook.com/fql?q=SELECT url, normalized_url, share_count, like_count, comment_count, total_count,commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url='http://www.google.com'
total_count 「いいね!」ボタンに表示される数字です。
share_count、like_countそしてcomment_count、それは思わないfqlし、REST APIはまだ最良の選択肢です... しかし、両方fqlとREST APIは、もはや2016年8月7日の後に利用できるようになります!助言がありますか?
                    グラフAPIは使用しないでください。どちらかを呼び出す場合:
または
両方が返されます:
{
  "id": "http://www.apple.com",
  "shares": 1146997
}
ただし、表示される数は次の合計です。
したがって、FQLを使用する必要があります。
この回答を見てください:    Facebookのいいね、フェッチ、コメントを記事から取得する方法
2016年8月7日以降も、次のように電話をかけることができます。
http://graph.facebook.com/?id=https://www.apple.com/
しかし、応答形式は異なります。
{
  "id": "http://www.apple.com",
  "shares": 1146997
}
しかし、代わりに
{
   "og_object": {
      "id": "388265801869",
      "description": "Get a first look at iPhone 7, Apple Watch Series 2, and the new AirPods \u2014 the future of wireless headphones. Visit the site to learn more.",
      "title": "Apple",
      "type": "website",
      "updated_time": "2016-09-20T08:21:03+0000"
   },
   "share": {
      "comment_count": 1,
      "share_count": 1094227
   },
   "id": "https://www.apple.com"
}
したがって、次のように応答を処理する必要があります。
reponse_variable.share.share_count
上記の1つのリンクで役に立ったと私が見つけたのは、link_statテーブルを見て、1つのリンクのいいね、合計、共有、クリック数を求めるこのFQLクエリです。
https://graph.facebook.com/fql?q=SELECT%20like_count,%20total_count,%20share_count,%20click_count,%20comment_count%20FROM%20link_stat%20WHERE%20url%20=%20%22http://google.com%22
それはこのようなものを出力します:
{
    data: [
        {
             like_count: 3440162,
             total_count: 13226503,
             share_count: 7732740,
             click_count: 265614,
             comment_count: 2053601
         }
    ]
}
この要点を確認してください。次のサービスの共有数を取得する方法のスニペットがあります。
入力しhttps://graph.facebook.com/?fields=share&id=https://www.example.comて、例を探しているURLまたはページに置き換えます。
Googleの例:https : //graph.facebook.com/?fields=share&id=https : //www.google.com
ルビーの宝石があります-SocialShares
現在、次のソーシャルネットワークをサポートしています。
使用法:
:000 > url = 'http://www.apple.com/'
  => "http://www.apple.com/"
:000 > SocialShares.facebook url
  => 394927
:000 > SocialShares.google url
  => 28289
:000 > SocialShares.twitter url
  => 1164675
:000 > SocialShares.all url
  => {:vkontakte=>44, :facebook=>399027, :google=>28346, :twitter=>1836, :mail_ru=>37, :odnoklassniki=>1, :reddit=>2361, :linkedin=>nil, :pinterest=>21011, :stumbleupon=>43035}
:000 > SocialShares.selected url, %w(facebook google linkedin)
  => {:facebook=>394927, :google=>28289, :linkedin=>nil}
:000 > SocialShares.total url, %w(facebook google)
  => 423216
:000 > SocialShares.has_any? url, %w(twitter linkedin)
  => true
あなたは使用することができますhttps://graph.facebook.com/v3.0/株式はカウントを取得する{Place_your_Page_IDここ} /フィード?フィールド= ID、株式、share_count&access_tokenは= {Place_your_access_token_hereを}。