gpt4 book ai didi

youtube - 从 channel ID 获取所有播放列表 ID - youtube api v3

转载 作者:行者123 更新时间:2023-12-03 23:28:18 28 4
gpt4 key购买 nike

我目前正在学习youtube api的使用.我要检索所有 playlists id来自 channel id .我通读了文档,发现我可以使用 youtube.channels.list对于这样的任务。我对 api_page 做了基本的测试.尽管如此,我还是不知道是什么 params用于获取 playlist id .如何检索所有 playlist ids来自给定的 channel id ?
https://www.googleapis.com/youtube/v3/channels?part=id&id=UCF0pVplsI8R5kcAqgtoRqoA&key={YOUR_API_KEY}

最佳答案

一个简单的方法:

YouTube API v3与资源 playlists.list

使用此参数获取 channel 的播放列表 ID:

part: 'snippet'
channelId: 'UCBkNpeyvBO2TdPGVC_PsPUA'

https://www.googleapis.com/youtube/v3/playlists?part=snippet&channelId=UCBkNpeyvBO2TdPGVC_PsPUA&key= {YOUR_API_KEY}

输出 :
 "items": [
{

"kind": "youtube#playlist",
"etag": "\"PSjn-HSKiX6orvNhGZvglLI2lvk/K21sgPQuMRCjhSMBjm3v3n5tl1o\"",
"id": "PL2qcutlDmS0CnyV8Jcbl2d7yFxd2iGg67",
"snippet": {
"publishedAt": "2014-07-08T03:13:37.000Z",
"channelId": "UCBkNpeyvBO2TdPGVC_PsPUA",
"title": "These Things Happen Series",
"description": "",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/93mgU_VXZrA/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/93mgU_VXZrA/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/93mgU_VXZrA/hqdefault.jpg",
"width": 480,
"height": 360
},
"standard": {
"url": "https://i.ytimg.com/vi/93mgU_VXZrA/sddefault.jpg",
"width": 640,
"height": 480
},
"maxres": {
"url": "https://i.ytimg.com/vi/93mgU_VXZrA/maxresdefault.jpg",
"width": 1280,
"height": 720
}
},
"channelTitle": "GEazyTV"
}
},
{

"kind": "youtube#playlist",
"etag": "\"PSjn-HSKiX6orvNhGZvglLI2lvk/5ifuvTYKbyV6DUPqbTa2bnO2jWY\"",
"id": "PL2qcutlDmS0B0jwHOQYzgRhJpnxDwPBHc",
"snippet": {
"publishedAt": "2014-06-05T07:36:58.000Z",
"channelId": "UCBkNpeyvBO2TdPGVC_PsPUA",
"title": "B-Sides",
"description": "",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/f7Ua9wKvVtI/default.jpg",
"width": 120,
"height": 90
},
"medium": {
"url": "https://i.ytimg.com/vi/f7Ua9wKvVtI/mqdefault.jpg",
"width": 320,
"height": 180
},
"high": {
"url": "https://i.ytimg.com/vi/f7Ua9wKvVtI/hqdefault.jpg",
"width": 480,
"height": 360
},
"standard": {
"url": "https://i.ytimg.com/vi/f7Ua9wKvVtI/sddefault.jpg",
"width": 640,
"height": 480
},
"maxres": {
"url": "https://i.ytimg.com/vi/f7Ua9wKvVtI/maxresdefault.jpg",
"width": 1280,
"height": 720
}
},
"channelTitle": "GEazyTV"
}
},
...

这是一个带有随机 channel 的示例。

如果您不知道如何获取 channel ID channel 使用资源 channels.list:

使用此参数获取播放列表的视频 ID:
part: 'id'
forUsername: 'channel_name'

https://www.googleapis.com/youtube/v3/channels?part=id&forUsername=GEazyTV&key= {YOUR_API_KEY}
 "items": [
{

"kind": "youtube#channel",
"etag": "\"PSjn-HSKiX6orvNhGZvglLI2lvk/vIwM6ev74Om0AOupX26jJoEDELU\"",
"id": "UCBkNpeyvBO2TdPGVC_PsPUA"
}

关于youtube - 从 channel ID 获取所有播放列表 ID - youtube api v3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26831919/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com