Facebook how to get actual photo URL using Graph API?

后端 未结 5 879
囚心锁ツ
囚心锁ツ 2021-02-05 11:44

It is possible to get the actual image url of a Facebook image using the Graph api??

For instance, for the below photo http://www.facebook.com/photo.php?fbid=3577553076

5条回答
  •  情深已故
    2021-02-05 12:14

    • From https://developers.facebook.com/docs/graph-api/using-graph-api :

    By default, not all fields in a node or edge are returned when you make a query. You can choose the fields or edges that you want returned with the fields query parameter.

    That's why when you retrieve a photo, you may only get created_time, name and id.

    • From https://developers.facebook.com/docs/graph-api/reference/photo/ :

    source field is deprecated in latest API (v2.8). Use images instead.

    So your query may look like this:

    GET graph.facebook.com/{photo-id}?fields=images
    

    Response should be like this:

    {
    
    "images":[
        {
            "height":358,
            "source":"https://scontent.xx.fbcdn.net/v/t1.0-9/15327427_585435148333529_xxxxxxxxxxxx_n.jpg?oh=xxxxxxxx&oe=xxxxxxxxx",
            "width":518
        },
        {
            "height":320,
            "source":"https://fb-s-c-a.akamaihd.net/h-ak-xtl1/v/t1.0-0/p320x320/15327427_xxxxxxxxxxxxxx_n.jpg?oh=xxxxxxxxxx&oe=xxxx&__gda__=xxxxxxxxxxxx",
            "width":463
        },
        {
            "height":130,
            "source":"https://fb-s-c-a.akamaihd.net/h-ak-xtl1/v/t1.0-0/p130x130/15327427_xxxxxxxxxxxxxx_n.jpg?oh=xxxxxxxxxxx&oe=xxx&__gda__=xxxxxxxxxxxxxxxxxx",
            "width":188
        },
        {
            "height":225,
            "source":"https://fb-s-c-a.akamaihd.net/h-ak-xtl1/v/t1.0-0/p75x225/15327427_xxxxxxxxxxxxxxx_n.jpg?oh=xxxxxxxxxxxxxxxxx&oe=xxxxxxxxxxxxxxxxxx&__gda__=xxxxxxxxxxxxxxxxxx",
            "width":325
        }
    ],
    "id":"585435148333529"
    
    }
    

提交回复
热议问题