【问题标题】:facebook graph - retrieve multiple photosfacebook graph - 检索多张照片
【发布时间】:2016-05-18 14:38:38
【问题描述】:

我想检索可以在单个 Facebook 帖子中发布的所有照片。 例如,在这个post 中,有两张照片。 使用 Graph API (https://graph.facebook.com/v2.6/AtifAslamOfficialFanPage/posts?fields=id,type,created_time,link,message,source,object_id&limit=10&access_token=xxx) 我得到这篇文章:

{
     "id": "182973122142_10153437154822143",
     "type": "photo",
     "created_time": "2016-03-18T17:47:23+0000",
     "link": "https://www.facebook.com/AtifAslamOfficialFanPage/photos/a.281303247142.151444.182973122142/10153437154412143/?type=3",
     "object_id": "10153437154412143"
  }

但只有一个object_id,即帖子的第一张照片。

是否可以检索所有照片?

【问题讨论】:

    标签: facebook facebook-graph-api


    【解决方案1】:

    请求attachments字段,182973122142_10153437154822143?fields=attachments,会得到如下数据结构:

    {
      "attachments": {
        "data": [
          {
            "subattachments": {
              "data": [
                {
                  "media": {
                    "image": {
                      "height": 266,
                      "src": "https://scontent.xx.fbcdn.net/v/t1.0-9/s720x720/10314482_10153437154412143_7582591571482186627_n.png?oh=a2b350ce8ac6ae546022295c7e73245a&oe=579E6E12",
                      "width": 720
                    }
                  },
                  "target": {
                    "id": "10153437154412143",
                    "url": "https://www.facebook.com/AtifAslamOfficialFanPage/photos/a.281303247142.151444.182973122142/10153437154412143/?type=3"
                  },
                  "type": "photo",
                  "url": "https://www.facebook.com/AtifAslamOfficialFanPage/photos/a.281303247142.151444.182973122142/10153437154412143/?type=3"
                },
                {
                  "media": {
                    "image": {
                      "height": 720,
                      "src": "https://scontent.xx.fbcdn.net/v/t1.0-9/p720x720/10314505_10153437154507143_8615151666809542144_n.jpg?oh=4255fb5699cf0a4d5c455be82cbb8efe&oe=57E38281",
                      "width": 720
                    }
                  },
                  "target": {
                    "id": "10153437154507143",
                    "url": "https://www.facebook.com/AtifAslamOfficialFanPage/photos/a.281303247142.151444.182973122142/10153437154507143/?type=3"
                  },
                  "type": "photo",
                  "url": "https://www.facebook.com/AtifAslamOfficialFanPage/photos/a.281303247142.151444.182973122142/10153437154507143/?type=3"
                }
              ]
            },
            "target": {
              "id": "10153437154822143",
              "url": "https://www.facebook.com/AtifAslamOfficialFanPage/posts/10153437154822143"
            },
            "title": "Photos from Atif Aslam's post",
            "type": "album",
            "url": "https://www.facebook.com/AtifAslamOfficialFanPage/posts/10153437154822143"
          }
        ]
      },
      "id": "182973122142_10153437154822143"
    }
    

    【讨论】:

      猜你喜欢
      • 2011-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多