2016-06-24 27 views
1
類別

熱門影片與影片,我需要澄清的YouTube API版本以下的事情3的Youtube API V3:pagenation的視頻效果,通過

1.Get視頻結果與分頁

我想結果與分頁,但nextPageToken和​​是從我的迴應無效。

這裏是我的代碼

$client = new Google_Client(); 
    $client->setDeveloperKey($DEVELOPER_KEY); 
    $youtube = new Google_Service_YouTube($client); 

    $searchResponse = $youtube->search->listSearch('id,snippet', array(
      'type' => 'video', 
      'q' => $_GET['q'], 
      /*'location' => $_GET['location'], 
      'locationRadius' => $_GET['locationRadius'],*/ 
      'maxResults' => 50, 
      'order' => 'viewCount' 
     )); 

2.Getting最受歡迎的視頻

如何獲得從API最流行的視頻我「維生素E與參數 'chart' => 'mostPopular'嘗試,但它會通過錯誤unknown parameter chart

3.按類別獲取視頻

我怎麼能按類別如獲得的視頻列表:獲得下music

+0

要使用的YouTube得到這個例如php腳本,或者通過url響應api。 – Shawon

回答

0

使用listVideos不listSearch得到最流行的視頻的視頻列表:

$trendingComedy = $youtube->videos->listVideos('snippet', array(
    'chart' => 'mostPopular', 
    'maxResults' => 50, 
    'regionCode' => 'GB', 
    'videoCategoryId' => '23' 
)); 
相關問題