LoginSignup
23
26

More than 5 years have passed since last update.

Facebook, Twitterでの拡散情報を取得する

Posted at

「うわー、このURLのソーシャルメディアでのシェア状況知りたいって感じやわー」ってことが3日に1日くらいあると思うので、メモがてら投稿します。


Facebook

  • xml
# https//google.comのいいねとシェア数を取得
https://api.facebook.com/method/fql.query?query=select%20like_count,%20share_count%20from%20link_stat%20where%20url=%22https://google.com%22

<fql_query_response xmlns="http://api.facebook.com/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" list="true">
  <link_stat>
    <like_count>86482</like_count>
    <share_count>134607</share_count>
  </link_stat>
</fql_query_response>
  • json
# https//google.comのいいねとシェア数を取得
https://api.facebook.com/method/fql.query?format=json&query=select%20like_count,%20share_count%20from%20link_stat%20where%20url=%22https://google.com%22

[
  {
    like_count: 86482,
    share_count: 134607
  }
]

Twitter

# https://facebook.comのツイートカウントを取得
http://urls.api.twitter.com/1/urls/count.json?url=https://facebook.com/

{
  count: 26250,
  url: "https://facebook.com/"
}

 

超簡単ですね。

23
26
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
23
26