Reputation: 3063
So I am trying to pull out videos from Youtube for specific video games. This I have working almost fine, however on querying the video game title, some (mostly ones that share names with sports franchises, films, etc) are coming back with non video game related results.
I have looked in the documentation here and found the topicId filter, however I am struggling to use it.
If I try to put something in it comes back with:
$searchResponse = $youtube->search->list(array(
'q' => $_GET['q'],
'maxResults' => $_GET['maxResults'],
'part' => 'id',
'order' => 'relevance',
'type' => 'video',
'topicId' => '/m/0d6lp'
));
(list) unknown parameter: 'topicId'
Also having trouble using the freebase API to return a topic I need.
All I want to do is filter videos only with the following:
So any ideas how I limit youtube searches to video games only with the search api?
Upvotes: 0
Views: 1369
Reputation: 2299
That example looks a little off. The release of the PHP client might not be updated for the YouTube release, but the code is checked it. Head to https://code.google.com/p/google-api-php-client/ and checkout the source to get an up to date version after that this code should work fine.
$searchResponse = $youtube->search->listSearch('id', array(
'q' => $_GET['q'],
'maxResults' => $_GET['maxResults'],
'order' => 'relevance',
'type' => 'video',
'topicId' => '/m/0d6lp'
));
Call listSearch
instead of list
, and put the part
as the first argument instead of in the array.
Upvotes: 2