2017-09-26 110 views
-1

我嘗試下面的代碼:如何實現的nextPageToken YouTube的API

$api_url = 'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=50&pageToken=CAoQAA&playlistId='.$playlist_id. '&key=' . 
$api_key; 

如果你給一個解決方案,我欣賞。

+1

Mam請張貼一些代碼..謝謝 –

+0

你有沒有試過這個mam https://stackoverflow.com/questions/20727560/retrieve-all-playlist-entry-youtube-api-v3-using-pagetoken? –

+0

我試過了,但即時通訊新的json,請幫我找到解決方案 –

回答

0

您將nextPageToken放入您的pageToken參數中。您可以檢查此SO post實際的代碼示例:

// checking if nextPageToken exist than return our function and 
     // insert $next_page_token with value inside nextPageToken 
    if(isset($searchResponse['nextPageToken'])){ 
      // return to our function and loop again 
     return youtube_search($query, $max_results, $searchResponse['nextPageToken']); 
    } 

此外,檢查this post額外的參考。