Instagram API returning square only (cropped) images

一个人想着一个人 提交于 2019-12-10 11:44:36

问题


1 year ago Instagram migrated the API to support landscape and portrait formats.

Looks like last week the api is returning a cropped square image.

Example: https://www.instagram.com/p/BHLY4N0jMfA/ (the image is not square)

Api endpoint (https://api.instagram.com/v1/tags/igapitest/media/recent) returns cropped square image:

...
images: {
    low_resolution: {
        url: "https://scontent.cdninstagram.com/t51.2885-15/s320x320/e35/c224.0.631.631/13556933_1110271362362401_1093314529_n.jpg?ig_cache_key=MTI4MjIyNzkzNTE2NDI4NjkxMg%3D%3D.2.c",
        width: 320,
        height: 320
    },
    thumbnail: {
        url: "https://scontent.cdninstagram.com/t51.2885-15/s150x150/e35/c224.0.631.631/13556933_1110271362362401_1093314529_n.jpg?ig_cache_key=MTI4MjIyNzkzNTE2NDI4NjkxMg%3D%3D.2.c",
        width: 150,
        height: 150
    },
    standard_resolution: {
        url: "https://scontent.cdninstagram.com/t51.2885-15/s480x480/e35/c224.0.631.631/13556933_1110271362362401_1093314529_n.jpg?ig_cache_key=MTI4MjIyNzkzNTE2NDI4NjkxMg%3D%3D.2.c",
        width: 480,
        height: 480
    }
},
...

Even if you try the media endpoint (https://api.instagram.com/v1/media/1282227935164286912_189136266) it returns cropped square images again.

Noticed that images used by the web Instagram comes from another cdn than the api returns.

Looks a bug in Instagram API? Any Suggestions?


回答1:


Have you checked the option for "Non-square images" in your API settings.

I checked the same media using my API, I get landscape images.

The image URL is same except I dont have c224.0.631.631/ in my API response's URLs, you can remove that from your URLs and you will get non-cropped images. But check your API settings.



来源:https://stackoverflow.com/questions/40342769/instagram-api-returning-square-only-cropped-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!