如何使用YouTube API V3和PHP获取流行视频



我尝试使用YouTube API使用图表参数,但表示图表不是有效的参数。我正在使用PHP。我有区域和类别,一切都很好。这是一个错误吗?我该怎么做?

这是我拥有的代码

  $searchResponse = $youtube->search->listSearch('id,snippet', array(
        //'type' => 'video',
        'part' => 'snippet',
          'location' => 'GB',
          'videoCategoryId' => '23',
         'chart' => 'mostPopular',
        'order' => 'date',
        'maxResults' => '50'
    ));

说:

发生了一个客户端错误:(列表(未知参数:'图表'

喜欢:

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

使用listVideos not ListSearch

最新更新