Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Youtube api V3:分页视频结果、趋势视频和按类别划分的视频_Php_Video_Youtube Data Api - Fatal编程技术网

Php Youtube api V3:分页视频结果、趋势视频和按类别划分的视频

Php Youtube api V3:分页视频结果、趋势视频和按类别划分的视频,php,video,youtube-data-api,Php,Video,Youtube Data Api,我需要澄清youtube api版本3中的以下内容 1.通过分页获取视频结果 我想通过分页获得结果,但是nextPageToken和prevPageToken在我的响应中为空 这是我的密码 $client = new Google_Client(); $client->setDeveloperKey($DEVELOPER_KEY); $youtube = new Google_Service_YouTube($client); $searchResponse = $y

我需要澄清youtube api版本3中的以下内容

1.通过分页获取视频结果

我想通过分页获得结果,但是
nextPageToken
prevPageToken
在我的响应中为空

这是我的密码

  $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.获取最受欢迎的视频

如何从我使用参数尝试过的api中获取最流行的视频
'chart'=>'mostPopular'
但它将通过错误
未知参数图表

3.按类别获取视频


如何按类别获取视频列表例如:获取
音乐
类别下的视频列表

使用listVideos而不是listSearch获取最受欢迎的视频:

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

使用listVideos而不是listSearch获取最受欢迎的视频:

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

您希望通过使用youtube示例php脚本,或通过响应api的url来获取此信息。您希望通过使用youtube示例php脚本,或通过响应api的url来获取此信息。