问题描述
链接示例:
- https://imgur.com/oUO812R (1.图片链接)
- https://imgur.com/OBEF9yi (2.图片链接)
- https://imgur.com/WRFBK (相册链接)
- https://imgur.com/oUO812R (1. image link)
- https://imgur.com/OBEF9yi (2. image link)
- https://imgur.com/WRFBK (album link)
当前,我只对所有链接执行https://api.imgur.com/3/gallery/[ID].json
,并获得is_album
是否正确.这适用于上面的1.图片链接和相册链接,但对于2.图片链接返回404(不知道为什么).
如果返回404,则我正在为该失败的图像执行图像api请求(https://api.imgur.com/3/image/OBEF9yi.json
).
Currently I'm just doing https://api.imgur.com/3/gallery/[ID].json
for all links and get wether is_album
is true or not. This works for the 1. image link and the album link above, but it returns 404 for the 2. image link (no idea why).
If it's returns 404, i'm doing an image api request (https://api.imgur.com/3/image/OBEF9yi.json
) for that failed image.
我想知道是否有一种更简便的方法(通过一个api调用)来确定哪个链接是哪种内容类型(相册或图片).
I want to know if there's a easier (with one api call) way to determine which link is which content type (either album or image).
推荐答案
我实际上在imgur api中发现了一个错误.网址不可能像这样获得一个简短的网址.报告给imgur&他们已经认识到了.
I actually found a bug in the imgur api. It shouldn't be possible to get a short URL like this for URLs. Reported to imgur & they have recognized it.
一旦修复,就可以进行图像api调用(https://api.imgur.com/3/image/[ID].json
),并弄清animated
是否为真.
As soon as they've fixed it, it is possible to do an image api call (https://api.imgur.com/3/image/[ID].json
) and get wheter animated
is true or not.
这篇关于从imgur API获取imgur内容类型的最简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!