문제

There are a lot of videos in the channel. Where as 'nextPageToken' only iterates about 570 of them on my code.

Perhaps not a lib issue because the same happens on https://developers.google.com/youtube/v3/docs/search/list. After about only 10 pages the nextPageToken disappears.

도움이 되었습니까?

해결책

You should using channel+playlistItems API to get ALL channel videos, not search API.

Kindly check it out on https://developers.google.com/youtube/v3/docs/channels/list#try-it.

Example, i set the channel id UCi-Lb1gFer4U7tkqFA1adiQ and part parameter as contentDetails.

the example of response is:

 "items": [
  {
   "id": "UCi-Lb1gFer4U7tkqFA1adiQ",
   "kind": "youtube#channel",
   "etag": "\"NT-fDeVOLsFPouddIzcaWbd0fJw/sQKRHjGLTreNbWWrW3gIojOKiEk\"",
   "contentDetails": {
    "relatedPlaylists": {
     "uploads": "UUi-Lb1gFer4U7tkqFA1adiQ"
    }
   }
  }
 ]

Then you know the uploads playlist id now, UUi-Lb1gFer4U7tkqFA1adiQ, so you visit

https://developers.google.com/youtube/v3/docs/playlistItems/list

Put UUi-Lb1gFer4U7tkqFA1adiQ as the playlistId, then you would able to get all the videos by pagination.

p/s: please provide your channel id, if you still experience the problem

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top