如何获取 YouTube 播放列表缩略图? [英] How to get a youtube playlist thumbnail?
问题描述
有没有办法像获取视频缩略图一样获取 youtube 播放列表缩略图,解释如下:如何从 YouTube API 获取 YouTube 视频缩略图?
Is there a way to get youtube playlist thumbnail like how you can get a thumbnail of a video, explained here: How do I get a YouTube video thumbnail from the YouTube API?
推荐答案
使用 YouTube API v3,您可以使用他们的 v3/playlists
端点获取播放列表缩略图并深入到 项目.snippet.thumbnails.high.url
With the YouTube API v3, you can get the playlist thumbnail using their v3/playlists
endpoint and drilling down to items.snippet.thumbnails.high.url
对于以下播放列表:
https://www.youtube.com/playlist?list=PL50C17441DA8A565D
YouTube 的 API 浏览器有一个播放列表端点:
YouTube's API explorer has a playlist endpoint:
https://developers.google.com/youtube/v3/docs/播放列表/列表
这是 API 调用:
GET https://www.googleapis.com/youtube/v3/playlists?part=snippet&id=PL50C17441DA8A565D&key={YOUR_API_KEY}
这是回应:
{
"kind": "youtube#playlistListResponse",
"items": [
{
"kind": "youtube#playlist",
"id": "PL50C17441DA8A565D",
"snippet": {
"title": "Jay Chou Playlist",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/kGbDymJ75PU/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/kGbDymJ75PU/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/kGbDymJ75PU/hqdefault.jpg",
"width": 480,
"height": 360
}
},
"channelTitle": "it23"
}
}
]
}
这篇关于如何获取 YouTube 播放列表缩略图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!