0

附件有一个问题...我尝试在一段时间内使用所有提要 Likes 和 Comments 检索页面。或者..实际上我只需要总体喜欢和评论的总数。

至今 ...

$user_pages = $facebook-> api ('/ me / accounts');

  ...

$page_feeds = $facebook-> api ("/". $ page_name ['id']. '/ feed', 'GET', array ('limit' => 10000, 'since' => mktime (0,0, 0, date ("m"), 1, date ("Y"))));

  ...

foreach ($page_feeds ['data'] as $ page) {

    $c = $facebook-> api ("/" $ page ['id'] "/ likes", "GET", array ('limit' => 10000)..);
    $temp ['likes'] = count ($ c ['data']);

    $c = $ facebook-> api ("/" $ page ['id'] "/ comments", "GET", array ('limit' => 10000)..);
    $temp ['comments'] = count ($ c ['data']);

}

  .....

因此,我得到了我作为管理员的所有页面,然后自本月第一天开始提供所有页面。这一直持续到答案出现为止。但问题是我最多只能获得最多 25 个最多 25 个喜欢和评论。(API文档中描述的“计数”一词,但我在这里遗漏了。

所以现在我必须在循环中调用每个提要的所有喜欢和评论,然后获取数字。

这些查询现在需要三分钟......这显然太长了......

这不是很好的方式吗?我已经能够找到任何东西。我希望我这个查询

$page_feeds = $ facebook-> api ("/". $ page_name ['id']. '/ feed', 'GET', array ('limit' => 10000, 'since' => mktime (0,0, 0, date ("m"), 1, date ("Y"))));

可以调整,然后所有喜欢和评论(或至少数字)以获得

150769909716/feed?fields=likes.limit(10000).fields(id),comments.limit(10000).fields(id)&limit=10000&since=1372608000

不幸的是,最多只给我 25 个赞和评论。

蒂莫

#

编辑:

https://graph.facebook.com/[pageid]/feed?fields=likes.limit%2810000%29.fields%28id%29,comments.limit%2810000%29.fields%28id%29&locale=de_DE&since=1372608000&limit=10000&access_token=yyyy

给我吗:

{
   "data": [
      {
         "id": "xxx_xxx",
         "created_time": "2013-07-23T07:08:25+0000",
         "likes": {
            "data": [
               {
                  "id": "xxxx"
               },
            ],
            "paging": {
               "cursors": {
                  "after": "xxx",
                  "before": "xxxx"
               },
               "next": "xxxx"
            }
         },



https://graph.facebook.com/[pageid]/feed?since=1372608000&limit=10000&access_token=yyyy

给我:(是的,我的伯爵在那里......但只有浏览器调用)

"likes": {
            "data": [
               {
                  "name": "xxx",
                  "id": "xxx"
               },
                ],
            **"count": 53**
         },

每次通话相同的通话给我的结果没有计数数据....

4

1 回答 1

1

不幸的是,Facebook 已删除,因为您在查看帖子时看到了喜欢和评论的总数。相反,您需要为每个帖子再次调用以检索总喜欢或评论。他们也将其从count重命名为total_count

例子:

对于喜欢

https://graph.facebook.com/POST_ID/likes/?summary=true

它会返回这样的东西

{
  "data": [
    {
      "id": "xxxx",
      "name": "xxxxx"
    },
    {
      "id": "xxxx",
      "name": "xxxxx"
    },
    {
      "id": "xxxx",
      "name": "xxxxx"
    },
    {
      "id": "xxxx",
      "name": "xxxxx"
    }
  ],
  "paging": {
    "cursors": {
      "after": "NTU2MTU3NjU0",
      "before": "MTA4OTM4NzgwMA=="
    }
  },
  "summary": {
    "total_count": 4
  }
}

评论:

https://graph.facebook.com/POST_ID/comments/?summary=true

{
  "data": [
    {
      "id": "xxxxx",
      "from": {
        "category": "Media/news/publishing",
        "category_list": [
          {
            "id": "xxxxxx",
            "name": "xxxx"
          },
          {
            "id": "xxxxxx",
            "name": "xxxx"
          }
        ],
        "name": "xxxxx",
        "id": "xxxxx"
      },
      "message": "xxxxxxx",
      "can_remove": false,
      "created_time": "2013-07-03T20:36:54+0000",
      "like_count": 0,
      "user_likes": false
    }
  ],
  "paging": {
    "cursors": {
      "after": "Mg==",
      "before": "Mg=="
    }
  },
  "summary": {
    "order": "ranked",
    "total_count": 2
  }
}
于 2013-08-10T23:28:48.110 回答