How can I get all photos in one post using Graph API?

后端 未结 2 611
暗喜
暗喜 2021-02-04 09:33
  {
    \"id\": \"11882030_4952296803730\", 
    \"from\": {
      \"name\": \"xxx\", 
      \"id\": \"11882030\"
    }, 
    \"message\": \"test\", 
    \"picture\": \"         


        
相关标签:
2条回答
  • 2021-02-04 09:48

    Based on Stéphane Bruckerts answer; you're after attachments. So I'd recommend simply requesting the attachments field in your graph request.

    0 讨论(0)
  • 2021-02-04 09:49

    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"
    

    Result:

    {
      "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
          }
        }
      ]
    }
    
    0 讨论(0)
提交回复
热议问题