如何使用Graph API在一个帖子中获取所有照片? [英] How can I get all photos in one post using Graph API?

查看:156
本文介绍了如何使用Graph API在一个帖子中获取所有照片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  {
    "id": "11882030_4952296803730", 
    "from": {
      "name": "xxx", 
      "id": "11882030"
    }, 
    "message": "test", 
    "picture": "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/408410_4952294483672_298434229_s.jpg", 
    "link": "https://www.facebook.com/photo.php?fbid=4952294483672&set=pcb.4952296803730&type=1&relevant_count=2", 
    "icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yx/r/og8V99JVf8G.gif", 
    "actions": [
      {
        "name": "Comment", 
        "link": "https://www.facebook.com/11882030/posts/4952296803730"
      }, 
      {
        "name": "Like", 
        "link": "https://www.facebook.com/11882030/posts/4952296803730"
      }
    ], 
    "privacy": {
      "description": "Friends", 
      "value": "ALL_FRIENDS", 
      "friends": "", 
      "networks": "", 
      "allow": "", 
      "deny": ""
    }, 
    "place": {
      "id": "471607792876974", 
      "name": "TTT", 
      "location": {
        "street": "", 
        "zip": "", 
        "latitude": x, 
        "longitude": x
      }
    }, 
    "type": "photo", 
    "status_type": "mobile_status_update", 
    "object_id": "4952294483672",
    "application": {
      "name": "Facebook for iPhone", 
      "namespace": "fbiphone", 
      "id": "6628568379"
    }, 
    "created_time": "2013-01-17T01:29:59+0000", 
    "updated_time": "2013-01-17T01:29:59+0000", 
    "comments": {
      "count": 0
    }
  }

如上所述,状态与两张照片。我可以在图片中获得第一张照片的缩略图URL,以及相关的链接&计数链接中的信息

As above, I posted a status with two photos. I can get the first photo's thumb URL in picture and the relevant link & count information in link.

但是如何获取每张照片的具体URL?

But how can I get each photo's specific URL?

推荐答案

FQL通常提供比Graph API更多的信息。您必须使用 FQL 表的附件参数来获取所有附件照片。

FQL often provides more information than Graph API. You have to use the attachment parameter of the stream FQL table to get all the attached photos.

SELECT attachment FROM stream 
 WHERE source_id = me() 
   AND post_id="11882030_4952296803730"

结果:

{
  "data": [
    {
      "attachment": {
        "media": [
          {
            "href": "https://www.facebook.com/photo.php?fbid=471082296...", 
            "alt": "", 
            "type": "photo", 
            "src": "https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash3/5826...", 
            "photo": {
              "aid": "4391039135", 
              "pid": "439104482145", 
              "fbid": 471507, 
              "owner": 102832, 
              "index": 1, 
              "width": 485, 
              "height": 172, 
              "images": [
                {
                  "src": "https://fbcdn-photos-a.akamaihd.net/hph...", 
                  "width": 130, 
                  "height": 46
                }
              ]
            }
          }
        ], 
        "name": "", 
        "caption": "", 
        "description": "", 
        "properties": [
        ], 
        "icon": "https://fbstatic-a.akamaihd.net/rsrc.phpjk.gif", 
        "fb_object_type": "album", 
        "fb_object_id": "4391044992857139135"
      },
      { 
        ... //Photo 2
      }
    }
  ]
}

这篇关于如何使用Graph API在一个帖子中获取所有照片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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