Facebook GRAPH API 照片喜欢计数,无需分页 [英] Facebook GRAPH API Photo like count without paging

查看:31
本文介绍了Facebook GRAPH API 照片喜欢计数,无需分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试获取 FB 图片的点赞数.我们计算点赞数的图片通常很受欢迎,因此获得了大量点赞.

I'm trying to get like counts for FB pictures. The pictures we are counting the likes for are usually VERY popular so have a big amounts of LIKES.

例如,再过 4 年"的奥巴马照片是 Facebook 上最受欢迎"的照片,点赞数超过 400 万.

For example, the " 4 more years" obama picture is the "most liked" on facebook with more than 4 million likes.

问题是,在 GRAPH API 对那张图片的响应中,我们没有获得计数数字,我必须翻阅整个四百万个赞才能获得数字......太疯狂了.

The problem is that nowhere in the GRAPH API reponse for that picture do we get the count number, I would have to page through the whole four million likes to get the number... its insane.

https://graph.facebook.com/10151255420886749/likes

{
   "data": [
      {
         "id": "100004002885259",
         "name": "Camy Doyna"
      },
      {
         "id": "100003495050210",
         "name": "Louzoco de Carvasal"
      },
      {
         "id": "536183064",
         "name": "Emily Brearley"
      },
      {
         "id": "100002742193990",
         "name": "Rosette Gracia Moukengue"
      },
      {
         "id": "100001107540696",
         "name": "Pacu00f4me Chazelle"
      },
      {
         "id": "100001035425365",
         "name": "Niklas Pulli"
      },
      {
         "id": "100003292089993",
         "name": "Barbara Grimm"
      },
      {
         "id": "642830020",
         "name": "Elin Vinterhed"
      },
      {
         "id": "100000718890127",
         "name": "Katya Katyusha"
      },
      {
         "id": "1644725575",
         "name": "Lara Corti"
      },
      {
         "id": "100002024205882",
         "name": "Garibyan Anna"
      },
      {
         "id": "100002159247248",
         "name": "Marcos Fernando"
      },
      {
         "id": "1725354804",
         "name": "Kevin Burk"
      },
      {
         "id": "1524833123",
         "name": "Roberto TwoHands Bertuccelli"
      },
      {
         "id": "1056165559",
         "name": "Arman Hossain Anand"
      },
      {
         "id": "1052974324",
         "name": "Kathy Johng Shelton"
      },
      {
         "id": "100000254736003",
         "name": "Tina Mosely"
      },
      {
         "id": "595281527",
         "name": "Kim Fontaine-Skronski"
      },
      {
         "id": "100002935725139",
         "name": "Iulian Boxerul"
      },
      {
         "id": "100001450004383",
         "name": "Nora Lachgar"
      },
      {
         "id": "100001859484728",
         "name": "Joan Breen"
      },
      {
         "id": "1802479070",
         "name": "Jan Meyer"
      },
      {
         "id": "1815802454",
         "name": "Gregory Nobre"
      },
      {
         "id": "100002988798465",
         "name": "Aika JU"
      },
      {
         "id": "100003737463206",
         "name": "Ingrid Theiszovu00e1-Bajusovu00e1"
      }
   ],
   "paging": {
      "next": "https://graph.facebook.com/10151255420886749/likes?limit=25&offset=25&__after_id=100003737463206"
   }
}

https://graph.facebook.com/10151255420886749

{
   "id": "10151255420886749",
   "from": {
      "category": "Politician",
      "name": "Barack Obama",
      "id": "6815841748"
   },
   "name": "Four more years.",
   "picture": "http://photos-a.ak.fbcdn.net/hphotos-ak-ash4/409202_10151255420886749_2117448131_s.jpg",
   "source": "http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash4/s720x720/409202_10151255420886749_2117448131_n.jpg",
   "height": 478,
   "width": 720,
   "images": [
      {
         "height": 1359,
         "width": 2048,
         "source": "http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash4/s2048x2048/409202_10151255420886749_2117448131_n.jpg"
      },
      {
         "height": 532,
         "width": 800,
         "source": "http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash4/409202_10151255420886749_2117448131_n.jpg"
      },
      {
         "height": 478,
         "width": 720,
         "source": "http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash4/s720x720/409202_10151255420886749_2117448131_n.jpg"
      },
      {
         "height": 398,
         "width": 600,
         "source": "http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash4/s600x600/409202_10151255420886749_2117448131_n.jpg"
      },
      {
         "height": 318,
         "width": 480,
         "source": "http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash4/s480x480/409202_10151255420886749_2117448131_n.jpg"
      },
      {
         "height": 212,
         "width": 320,
         "source": "http://sphotos-a.ak.fbcdn.net/hphotos-ak-ash4/s320x320/409202_10151255420886749_2117448131_n.jpg"
      },
      {
         "height": 119,
         "width": 180,
         "source": "http://photos-a.ak.fbcdn.net/hphotos-ak-ash4/409202_10151255420886749_2117448131_a.jpg"
      },
      {
         "height": 86,
         "width": 130,
         "source": "http://photos-a.ak.fbcdn.net/hphotos-ak-ash4/409202_10151255420886749_2117448131_s.jpg"
      },
      {
         "height": 86,
         "width": 130,
         "source": "http://photos-a.ak.fbcdn.net/hphotos-ak-ash4/s75x225/409202_10151255420886749_2117448131_s.jpg"
      }
   ],
   "link": "http://www.facebook.com/photo.php?fbid=10151255420886749&set=a.53081056748.66806.6815841748&type=1",
   "icon": "http://static.ak.fbcdn.net/rsrc.php/v2/yz/r/StEh3RhPvjk.gif",
   "created_time": "2012-11-07T04:15:07+0000",
   "updated_time": "2012-11-07T04:15:07+0000",
   "comments": {
      "data": [
         {
            "id": "10151255420886749_12810477",
            "from": {
               "name": "David Carol",
               "id": "100003175318626"
            },
            "message": "BISHOP ZACHARY KAKOBE VERIFIED AIDS HEALING MIRACLES IN HIS MINISTRIES. THIS MINISTRY REGISTERED IN U.S.A IN 2010. WEBSITE: WWW.bishopzacharykakobe.org",
            "can_remove": false,
            "created_time": "2012-11-28T20:00:21+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12811019",
            "from": {
               "name": "Lievin Bangali",
               "id": "1812106678"
            },
            "message": "Barack Obama, Felicitation de votre reelection. Il est grand temps d'agir pour la situation de l'EST de la RD Congo. Merci et courage!",
            "can_remove": false,
            "created_time": "2012-11-28T20:40:28+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12811211",
            "from": {
               "name": "Pamela Aupindi",
               "id": "100004586432226"
            },
            "message": "President Obama is not only a charismatic leader but an obviously passionate man. One can feel the love for his wife through the pic! Amazing",
            "can_remove": false,
            "created_time": "2012-11-28T20:54:40+0000",
            "like_count": 1,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12811850",
            "from": {
               "name": "Ardavan Shafiie",
               "id": "1174217484"
            },
            "message": "graet picture",
            "can_remove": false,
            "created_time": "2012-11-28T21:35:26+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12812793",
            "from": {
               "name": "Samson Anifowose",
               "id": "658496517"
            },
            "message": "All the best!",
            "can_remove": false,
            "created_time": "2012-11-28T22:51:30+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12814187",
            "from": {
               "name": "Yago Costa",
               "id": "100000919886198"
            },
            "message": "isso ae negao !!!",
            "can_remove": false,
            "created_time": "2012-11-29T00:39:57+0000",
            "like_count": 1,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12814238",
            "from": {
               "name": "Sena Raharja",
               "id": "100004587874401"
            },
            "message": "wow",
            "can_remove": false,
            "created_time": "2012-11-29T00:43:08+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12814255",
            "from": {
               "name": "Getachew Biratu",
               "id": "100004104261949"
            },
            "message": "Better u0040 home...!!!",
            "can_remove": false,
            "created_time": "2012-11-29T00:43:45+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12814350",
            "from": {
               "name": "Bennydictus Ari Setiabudi",
               "id": "714307966"
            },
            "message": "uhuk... lama2 terkikis image seno raharjo... XD",
            "can_remove": false,
            "created_time": "2012-11-29T00:50:10+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12814615",
            "from": {
               "name": "Sena Raharja",
               "id": "100004587874401"
            },
            "message": "mukanya mirip gua. Ini foto bikin rekor dunia.",
            "can_remove": false,
            "created_time": "2012-11-29T01:06:44+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12814662",
            "from": {
               "name": "Bennydictus Ari Setiabudi",
               "id": "714307966"
            },
            "message": "beda nasib dikit doang kali y... hehehe... :D",
            "can_remove": false,
            "created_time": "2012-11-29T01:09:59+0000",
            "like_count": 1,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12814794",
            "from": {
               "name": "Subhash Biradar",
               "id": "100003474405756"
            },
            "message": "    Its better...ha ha ha ha.",
            "can_remove": false,
            "created_time": "2012-11-29T01:20:35+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12815269",
            "from": {
               "name": "Barbara J. Beverly",
               "id": "1348022951"
            },
            "message": "I am still smiling and happy....such a wonderful day in America.",
            "can_remove": false,
            "created_time": "2012-11-29T01:51:15+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12815652",
            "from": {
               "name": "Phillip Mason",
               "id": "100001280178407"
            },
            "message": "Makes me want to throw up. The Muslim and his ..........",
            "can_remove": false,
            "created_time": "2012-11-29T02:17:19+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12815699",
            "from": {
               "name": "Jeremiah Bates",
               "id": "100000912015322"
            },
            "message": "The clown above me is far below me .",
            "can_remove": false,
            "created_time": "2012-11-29T02:21:04+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12815758",
            "from": {
               "name": "Jeremiah Bates",
               "id": "100000912015322"
            },
            "message": "Sad...Phillip Mason, they have self help tapes, education programs, support groups for uneducated fools such as yourself....",
            "can_remove": false,
            "created_time": "2012-11-29T02:26:12+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12816036",
            "from": {
               "name": "Romy Christie",
               "id": "100003856980181"
            },
            "message": "To Barbara J Beverly, I completely agree with you, what a Wonderful day for America, long live President Obama, may his next four years leave him a shining place in history! Great charisma and a great orator, I believe that he is doing his utmost with the heavy burden that was put upon his shoulders when he first began... From Romy, British National, Permanent resident in Tokyo Japan.November 29th2012 instant.",
            "can_remove": false,
            "created_time": "2012-11-29T02:45:35+0000",
            "like_count": 1,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12818055",
            "from": {
               "name": "u0122in u01feblsku00e5 Ku00e4nu0115",
               "id": "100001520690200"
            },
            "message": "u0641u0649 u0627u064au0647 u064au0627 u0648u0644u0627u062f u0627u0644.........",
            "can_remove": false,
            "created_time": "2012-11-29T06:37:20+0000",
            "like_count": 1,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12818064",
            "from": {
               "name": "Cm Amgad",
               "id": "100001979501265"
            },
            "message": "u0627u0646u062au0627 u064au0627 u0639u0645 u0628u0627u0631u0627u0643 u0627u0648u0628u0627u0645u0627",
            "can_remove": false,
            "created_time": "2012-11-29T06:38:26+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12818067",
            "from": {
               "name": "Cm Amgad",
               "id": "100001979501265"
            },
            "message": "u0644u0645u0627 u0627u0644u0627u0633u062au0627u0630 u062cu064au0646 u064au062au0643u0644u0645 u062au0631u062f u0639u0644u064au0629 u064au0627 u0643u0633u0645u0643",
            "can_remove": false,
            "created_time": "2012-11-29T06:39:21+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12818275",
            "from": {
               "name": "Denise Mutty Henry",
               "id": "707184927"
            },
            "message": "who is the boss? michele of course",
            "can_remove": false,
            "created_time": "2012-11-29T07:21:36+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12818295",
            "from": {
               "name": "Steve Muguerza",
               "id": "100001926262266"
            },
            "message": "Dont worry honey I will do as you say and begin down america with the americas helping me they are so so weak we will just send them a check and keep them down like we keep the blacks down and in their place. Keep them poor and uneducated and teach them to rap.",
            "can_remove": false,
            "created_time": "2012-11-29T07:25:55+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12818637",
            "from": {
               "name": "David Torrens",
               "id": "699130216"
            },
            "message": "So USA votes for the right team after all.  And there was me thinking you might go back to a rather bushy nut.",
            "can_remove": false,
            "created_time": "2012-11-29T08:48:22+0000",
            "like_count": 1,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12818837",
            "from": {
               "category": "Fictional character",
               "name": "u0645u064fu0640u0633u062au062du064au0640u0640u0640u0640u0644 u0623u0646u0640u0633u0640u0640u0640u0640u0627u0643u064au0650 u0644u0623u0646u0646u0651u0640u0640u0640u0640u064a u0639u0627u064au0640u0640u0640u0640u0634u064c u0639u0644u0640u0640u0640u0640u064a u0630u0643u0640u0640u0640u0631u0627u0643u0640u0640u0640u0640u0640u064au0650",
               "id": "101906399977956"
            },
            "message": "http://www.facebook.com/pages/u0025D9u002585u0025D9u00258Fu0025D8u0025B3u0025D8u0025AAu0025D8u0025ADu0025D9u00258Au0025D9u002580u0025D9u002580u0025D9u002580u0025D9u002580u0025D9u002580u0025D9u002580u0025D9u002584-u0025D8u0025A7u0025D9u002586u0025D8u0025B3u0025D9u002580u0025D9u002580u0025D9u002580u0025D9u002580u0025D9u002580u0025D8u0025A7u0025D9u002583u0025D9u00258A-u0025D9u002584u0025D8u0025A3u0025D9u002586u0025D9u002586u0025D9u00258A-u0025D8u0025B9u0025D8u0025A7u0025D9u00258Au0025D8u0025B4-u0025D8u0025B9u0025D9u002584u0025D9u00258A-u0025D8u0025B0u0025D9u002583u0025D8u0025B1u0025D8u0025A7u0025D9u002583u0025D9u00258A/101906399977956?ref=hl",
            "can_remove": false,
            "created_time": "2012-11-29T09:36:54+0000",
            "like_count": 0,
            "user_likes": false
         },
         {
            "id": "10151255420886749_12819093",
            "from": {
               "name": "Mojisola Otu",
               "id": "100000238597273"
            },
            "message": "All the Best.
My family prays for yours.",
            "can_remove": false,
            "created_time": "2012-11-29T10:41:24+0000",
            "like_count": 1,
            "user_likes": false
         }
      ],
      "paging": {
         "next": "https://graph.facebook.com/10151255420886749/comments?limit=25&offset=25&__after_id=10151255420886749_12819093"
      }
   },
   "likes": {
      "data": [
         {
            "id": "100004002885259",
            "name": "Camy Doyna"
         },
         {
            "id": "100003495050210",
            "name": "Louzoco de Carvasal"
         },
         {
            "id": "536183064",
            "name": "Emily Brearley"
         },
         {
            "id": "100002742193990",
            "name": "Rosette Gracia Moukengue"
         },
         {
            "id": "100001107540696",
            "name": "Pacu00f4me Chazelle"
         },
         {
            "id": "100001035425365",
            "name": "Niklas Pulli"
         },
         {
            "id": "100003292089993",
            "name": "Barbara Grimm"
         },
         {
            "id": "642830020",
            "name": "Elin Vinterhed"
         },
         {
            "id": "100000718890127",
            "name": "Katya Katyusha"
         },
         {
            "id": "1644725575",
            "name": "Lara Corti"
         },
         {
            "id": "100002024205882",
            "name": "Garibyan Anna"
         },
         {
            "id": "100002159247248",
            "name": "Marcos Fernando"
         },
         {
            "id": "1725354804",
            "name": "Kevin Burk"
         },
         {
            "id": "1524833123",
            "name": "Roberto TwoHands Bertuccelli"
         },
         {
            "id": "1056165559",
            "name": "Arman Hossain Anand"
         },
         {
            "id": "1052974324",
            "name": "Kathy Johng Shelton"
         },
         {
            "id": "100000254736003",
            "name": "Tina Mosely"
         },
         {
            "id": "595281527",
            "name": "Kim Fontaine-Skronski"
         },
         {
            "id": "100002935725139",
            "name": "Iulian Boxerul"
         },
         {
            "id": "100001450004383",
            "name": "Nora Lachgar"
         },
         {
            "id": "100001859484728",
            "name": "Joan Breen"
         },
         {
            "id": "1802479070",
            "name": "Jan Meyer"
         },
         {
            "id": "1815802454",
            "name": "Gregory Nobre"
         },
         {
            "id": "100002988798465",
            "name": "Aika JU"
         },
         {
            "id": "100003737463206",
            "name": "Ingrid Theiszovu00e1-Bajusovu00e1"
         }
      ],
      "paging": {
         "next": "https://graph.facebook.com/10151255420886749/likes?limit=25&offset=25&__after_id=100003737463206"
      }
   }
}

执行诸如添加具有高得离谱的分页限制参数之类的操作太慢了......有没有办法直接获得计数?

Doing something like adding a paging limit parameter with a ridiculously high value is way too slow... is there a way to get the count number straight up?

推荐答案

您可以通过 photo FQL 表:

You can retrieve this information via the photo FQL table:

select like_info from photo where object_id = 10151255420886749;

返回:

{
  "data": [
    {
      "like_info": {
        "can_like": true, 
        "like_count": 4444816, 
        "user_likes": false
      }
    }
  ]
}

这篇关于Facebook GRAPH API 照片喜欢计数,无需分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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