I try using the chart parameter to get trending videos, 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'
You are looking for Videos list endpoint not Search list endpoint, you can get the most popular videos for your regionCode
& videoCategoryId
with :
$videosResponse = $youtube->videos->listVideos('snippet', array(
'chart' => 'mostPopular',
'maxResults' => 50,
'regionCode' => 'GB',
'videoCategoryId' => '23'
));