-4

I tried using the chart parameter with the YouTube API, but it says that chart is not a valid parameter. I am using PHP. I have the region and category and everything set fine. Is this a bug? How do I do it?

Here is the code I have

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

Says:

An client error occurred: (list) unknown parameter: 'chart'

Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
Please Help
  • 929
  • 1
  • 8
  • 11

1 Answers1

0

like so:

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

use listVideos not listSearch

Ethan SK
  • 736
  • 8
  • 12