alaouy / YouTube

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

listChannelVideos returns same nextPageToken #107

Closed godiez closed 6 years ago

godiez commented 6 years ago

I'm using this code:

$videosIds = Youtube::listChannelVideos($youtube_account_id, 50, null, ['id'], true);

It returns: array:2 [ "results" => array:50 [ ................. ] "info" => array:6 [ "resultsPerPage" => 50 "totalResults" => 156 "kind" => "youtube#searchListResponse" "etag" => ""DuHzAJ-eQIiCIp7p4ldoVcVAOeY/TAdUGz3huAx7bGOuEb64gJWgS58"" "prevPageToken" => null "nextPageToken" => "CDIQAA" ] ]

Then: Youtube::listChannelVideos($youtube_account_id, 50, null, ['id'], $info['nextPageToken']);

And it returns same data and same info (same token)

Thanks.

alaouy commented 6 years ago

You need to use the paginate results method like described in the doc https://github.com/alaouy/Youtube#basic-search-pagination

// Go to next page in result
$search = Youtube::paginateResults($params, $pageTokens[0]);
godiez commented 6 years ago

Thank you for your response. I've solved it!