嗨,朋友,我正在尝试使用youtube API使用ChannelID中的频道播放列表的确切计数。
是的,是可以通过使用youtube v3 api和playlist.list与通道ID一起使用。
从Channel ID获取所有播放列表ID -YouTube API V3显示了如何从API获取播放列表ID。
通过API Explorer发送的请求:
part: snippet
channelId: UCBkNpeyvBO2TdPGVC_PsPUA
playlist.list
的响应{
"kind": "youtube#playlistListResponse",
"etag": ""uQc-MPTsstrHkQcRXL3IWLmeNsM/GayOzLnLt1ndQVz5WvCaYWPuXUo"",
"nextPageToken": "CAUQAA",
"pageInfo": {
"totalResults": 14, <--- Total number of playlists.
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#playlist",
"etag": ""uQc-MPTsstrHkQcRXL3IWLmeNsM/llWSSTxPt1F74kWJeadntx0oOlU"",
"id": "PL2qcutlDmS0BGjOf5rwjWNH6JnyFEShyb",
"snippet": {
// snippet information, title etc
}
},
{
"kind": "youtube#playlist",
"etag": ""uQc-MPTsstrHkQcRXL3IWLmeNsM/D7iFaGmnjkkw29IXm-6kWaCd0a8"",
"id": "PL2qcutlDmS0DUCGOdr5eYDwZC_1JAReI4",
"snippet": {
},
{
"kind": "youtube#playlist",
"etag": ""uQc-MPTsstrHkQcRXL3IWLmeNsM/0MGgZUqxHh3qkYePoEP3C9ZPamU"",
"id": "PL2qcutlDmS0DMB6Xv2KmlKzdOtNqMOwpv", // Count 3
"snippet": {
// snippet information, title etc
}
},
{
"kind": "youtube#playlist",
"etag": ""uQc-MPTsstrHkQcRXL3IWLmeNsM/XMQu1lYA_nJGBD5l7JknPncuwv0"",
"id": "PL2qcutlDmS0CnyV8Jcbl2d7yFxd2iGg67",
"snippet": {
// snippet information, title etc
}
}
]
}
您可以使用pageInfo
使用totalResults
来获取该频道的播放列表。