Facebook GRAPH API照片计数没有分页

时间:2013-01-18 21:53:44

标签: facebook-graph-api count facebook-like

我正在试图获得FB图片的数量。我们计算的图片通常非常受欢迎,因此有大量的喜欢。

例如,“4年多”的奥巴马图片是Facebook上“最受欢迎”的图片,有超过400万的喜欢。

问题是GRAPH API对该图片没有任何反应,我们得到了计数,我不得不翻阅整个四百万的喜欢来获得这个数字......它疯了。

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": "Pac\u00f4me 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 Theiszov\u00e1-Bajusov\u00e1"
      }
   ],
   "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 \u01feblsk\u00e5 K\u00e4n\u0115",
               "id": "100001520690200"
            },
            "message": "\u0641\u0649 \u0627\u064a\u0647 \u064a\u0627 \u0648\u0644\u0627\u062f \u0627\u0644.........",
            "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": "\u0627\u0646\u062a\u0627 \u064a\u0627 \u0639\u0645 \u0628\u0627\u0631\u0627\u0643 \u0627\u0648\u0628\u0627\u0645\u0627",
            "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": "\u0644\u0645\u0627 \u0627\u0644\u0627\u0633\u062a\u0627\u0630 \u062c\u064a\u0646 \u064a\u062a\u0643\u0644\u0645 \u062a\u0631\u062f \u0639\u0644\u064a\u0629 \u064a\u0627 \u0643\u0633\u0645\u0643",
            "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": "\u0645\u064f\u0640\u0633\u062a\u062d\u064a\u0640\u0640\u0640\u0640\u0644 \u0623\u0646\u0640\u0633\u0640\u0640\u0640\u0640\u0627\u0643\u064a\u0650 \u0644\u0623\u0646\u0646\u0651\u0640\u0640\u0640\u0640\u064a \u0639\u0627\u064a\u0640\u0640\u0640\u0640\u0634\u064c \u0639\u0644\u0640\u0640\u0640\u0640\u064a \u0630\u0643\u0640\u0640\u0640\u0631\u0627\u0643\u0640\u0640\u0640\u0640\u0640\u064a\u0650",
               "id": "101906399977956"
            },
            "message": "http://www.facebook.com/pages/\u0025D9\u002585\u0025D9\u00258F\u0025D8\u0025B3\u0025D8\u0025AA\u0025D8\u0025AD\u0025D9\u00258A\u0025D9\u002580\u0025D9\u002580\u0025D9\u002580\u0025D9\u002580\u0025D9\u002580\u0025D9\u002580\u0025D9\u002584-\u0025D8\u0025A7\u0025D9\u002586\u0025D8\u0025B3\u0025D9\u002580\u0025D9\u002580\u0025D9\u002580\u0025D9\u002580\u0025D9\u002580\u0025D8\u0025A7\u0025D9\u002583\u0025D9\u00258A-\u0025D9\u002584\u0025D8\u0025A3\u0025D9\u002586\u0025D9\u002586\u0025D9\u00258A-\u0025D8\u0025B9\u0025D8\u0025A7\u0025D9\u00258A\u0025D8\u0025B4-\u0025D8\u0025B9\u0025D9\u002584\u0025D9\u00258A-\u0025D8\u0025B0\u0025D9\u002583\u0025D8\u0025B1\u0025D8\u0025A7\u0025D9\u002583\u0025D9\u00258A/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.\nMy 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": "Pac\u00f4me 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 Theiszov\u00e1-Bajusov\u00e1"
         }
      ],
      "paging": {
         "next": "https://graph.facebook.com/10151255420886749/likes?limit=25&offset=25&__after_id=100003737463206"
      }
   }
}

做一些像添加一个非常高的值的分页限制参数这样的事情太慢了......有没有办法让计数数字直线上升?

2 个答案:

答案 0 :(得分:11)

你也可以尝试/喜欢?summary = 1来将“summary / total_count”添加到你的结果中,所以

https://graph.facebook.com/10151255420886749/likes?summary=1

返回:

{
  "data": [
    {
      "id": "100004351206696",
      "name": "Marcos Nones"
    },
    {
      "id": "100002271852907",
      "name": "Kishor Ray"
    },
    ...
  ],
  "paging": {
    "cursors": {
      "after": "MTU4NTQ1MzczMw==",
      "before": "MTAwMDA0MzUxMjA2Njk2"
    },
    "next": "https://graph.facebook.com/10151255420886749/likes?summary=1&limit=25&after=MTU4NTQ1MzczMw%3D%3D"
  },
  "summary": {
    "total_count": 4434080
  }
}

答案 1 :(得分:10)

您可以通过photo FQL table

检索此信息
select like_info from photo where object_id = 10151255420886749;

返回:

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