使用 YouTube 数据 API,我可以检索视频资源的缩略图列表。这个请求...
GET https://www.googleapis.com/youtube/v3/videos?part=snippet&id=DUM1284TqFc&fields=items%2Fsnippet%2Fthumbnails&key={YOUR_API_KEY}
...生成此响应...
{
"items": [
{
"snippet": {
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/DUM1284TqFc/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/DUM1284TqFc/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/DUM1284TqFc/hqdefault.jpg",
"width": 480,
"height": 360
},
"standard": {
"url": "https://i.ytimg.com/vi/DUM1284TqFc/sddefault.jpg",
"width": 640,
"height": 480
},
"maxres": {
"url": "https://i.ytimg.com/vi/DUM1284TqFc/maxresdefault.jpg",
"width": 1280,
"height": 720
}
}
}
}
]
}
(API Explorer)
maxres
对象有 width
和 height
的 1280
和 720
.但是,url
( https://i.ytimg.com/vi/DUM1284TqFc/maxresdefault.jpg ) 实际上指向 1920x1080 图像。似乎生成的“maxres”缩略图与原始上传的视频大小相同,并且此特定视频的大小 (https://youtu.be/DUM1284TqFc) 为 1920x1080。
我找不到此视频的 1280x720 缩略图。
width
做什么和 height
属性指的是? 最佳答案
这似乎是 YouTube API 中的一个错误。根据文档,maxres 缩略图对应于:
The highest resolution version of the thumbnail image. This image size is available for some videos and other resources that refer to videos, like playlist items or search results. This image is 1280px wide and 720px tall.
关于YouTube 数据 API 返回 "maxres"缩略图的错误大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35078575/