Youtube api v3 无法检索频道中的所有视频

Youtube api v3 cannot retrieve all videos from a channel

我正在尝试使用 youtube 数据 api 从一个频道获取所有视频。但它不适用于特定频道。 (它适用于其他几个频道。)

从截图中可以看出,该频道有135个视频。

但是,我使用播放列表项和搜索 api,如下所示。他们只有 return 9 个视频。这里有什么问题?谢谢

GET https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=UUhTMiw43iw4w-ggOEXmPtfg&key={YOUR_API_KEY} 

GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UChTMiw43iw4w-ggOEXmPtfg&maxResults=50&type=video&key={YOUR_API_KEY}

基本上你是在处理两个具有相同 title 的不同频道,但这是可以接受的,因为 customUrl 是不同的,这里有详细信息:

1。 DharmaYogaCenter:UChTMiw43iw4w-ggOEXmPtfg - 标题:DharmaYogaCenter

GET https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics&id=UChTMiw43iw4w-ggOEXmPtfg&key={YOUR_API_KEY}

``` json 
{
    "title": "DharmaYogaCenter",
    "description": "We are a full yoga center located in Bremerton Washington.  We believe yoga and meditation is for everyone.  Stop by our Yoga Center and enjoy a blissful meditation, yoga class or just some good community.  We offer many free classes every month.  www.dharmayogacenter.net",
    "customUrl": "DharmaYogaCenter",
    "publishedAt": "2009-06-11T21:43:56.000Z",
    ...
    "relatedPlaylists": {
     "uploads": "UChTMiw43iw4w-ggOEXmPtfg",
    ...
    "videoCount": "9"
    ...
```

您可以查看这里只有几个视频:uploaded videos in channel UC8hnoz74NP5V5sxkuxXk2kA

"youtube#channel" "id": UChTMiw43iw4w-ggOEXmPtfg

GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&id=UChTMiw43iw4w-ggOEXmPtfg&key={YOUR_API_KEY} 获取频道 "uploads": "UUhTMiw43iw4w-ggOEXmPtfg"

的播放列表 ID

上传播放列表:UUhTMiw43iw4w-ggOEXmPtfg "totalResults":9

获取https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=UUhTMiw43iw4w-ggOEXmPtfg&key={YOUR_API_KEY}

{
 "kind": "youtube#playlistItemListResponse",
 "etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/yvjEzYc-CE8RBoXkFDTMPf_O1XM\"",
 "pageInfo": {
  "totalResults": 9,
  "resultsPerPage": 50
 },...

2。 TheDharmaTube:UC8hnoz74NP5V5sxkuxXk2kA - 标题:DharmaYogaCenter

GET https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics&id=UC8hnoz74NP5V5sxkuxXk2kA&key={YOUR_API_KEY}

{ 
    "title": "DharmaYogaCenter",
    "description": "Be receptive",
    "customUrl": "TheDharmaTube",
    "publishedAt": "2011-02-24T22:54:31.000Z",
    ...
    "relatedPlaylists": {
     "uploads": "UU8hnoz74NP5V5sxkuxXk2kA",
    ...
    "videoCount": "142"

您可以在此处查看更多视频:uploaded videos in channel UC8hnoz74NP5V5sxkuxXk2kA ..打开后向下滚动以加载所有视频

"youtube#channel" "id": UC8hnoz74NP5V5sxkuxXk2kA

GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&id=UC8hnoz74NP5V5sxkuxXk2kA&key={YOUR_API_KEY} 获取频道 "uploads": "UU8hnoz74NP5V5sxkuxXk2kA"

的播放列表 ID

上传播放列表:UU8hnoz74NP5V5sxkuxXk2kA "totalResults":142

获取https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&playlistId=UU8hnoz74NP5V5sxkuxXk2kA&key={YOUR_API_KEY} "totalResults": 142,

{
 "kind": "youtube#playlistItemListResponse",
 "etag": "\"XI7nbFXulYBIpL0ayR_gDh3eu1k/jm3DhRxnqdMzu1DGtIoiLbpEFY4\"",
 "nextPageToken": "CDIQAA",
 "pageInfo": {
  "totalResults": 142,
  "resultsPerPage": 50
 },...