Instagram API仅返回正方形(已裁剪)图像 [英] Instagram API returning square only (cropped) images

查看:101
本文介绍了Instagram API仅返回正方形(已裁剪)图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1年前,Instagram迁移了API以支持横向和纵向格式.

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

就像上周,api返回了裁剪后的正方形图像.

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

示例: https://www.instagram.com/p/BHLY4N0jMfA/(图片不是正方形)

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

Api端点( https://api.instagram.com/v1/tags/igapitest/media/recent )返回裁剪后的方形图片:

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
    }
},
...

即使您尝试使用媒体端点( https://api.instagram.com/v1/media/1282227935164286912_189136266 ),它将再次返回裁剪后的正方形图像.

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

注意到网络Instagram使用的图像来自API返回的另一个CDN.

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

在Instagram API中查找错误?有什么建议吗?

Looks a bug in Instagram API? Any Suggestions?

推荐答案

您是否已在API设置中选中非正方形图像"选项.

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

我使用API​​检查了相同的媒体,获得了风景图片.

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

图像URL相同,只是我的API响应的URL中没有c224.0.631.631/,您可以将其从URL中删除,然后得到未裁剪的图像.但是请检查您的API设置.

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.

这篇关于Instagram API仅返回正方形(已裁剪)图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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