alaouy / YouTube

🔥 Laravel PHP Facade/Wrapper for the Youtube Data API
MIT License
782 stars 204 forks source link

How to paginate videos from channelId ? #146

Closed boypanjaitan16 closed 4 years ago

boypanjaitan16 commented 4 years ago

In the example you just show the way to paginate from search results, but how to do it with videos from channelId ?

Korko commented 4 years ago

I guess what you mean by videos from channelId is getPlaylistItemsByPlaylistId($playlistId, $pageToken = '', $maxResults = 50, $part = ['id', 'snippet', 'contentDetails', 'status'])?

The $pageToken is the key. First call, no pageToken, the result may contain a ['info']['nextPageToken']. You can then call the same method again with the pageToken. You will then fetch the next page of results.