Youtube列表搜索与cc筛选器?
问题描述:
我正在使用google-api-php-client搜索YouTube视频,我想过滤结果以仅返回带有字幕(cc)的视频。Youtube列表搜索与cc筛选器?
可能吗?如果是,我应该如何修改查询?
$searchResponse = $youtube->search->listSearch('id,snippet', array(
'q' => $_GET['q'],
'maxResults' => $_GET['maxResults'],
));
谢谢。
答
https://developers.google.com/youtube/v3/docs/search/list
的API文档提到一个videoCaption
字符串参数
的videoCaption参数指示API是否应该过滤基于他们是否有字幕的视频搜索结果。如果您为此参数指定值,则还必须将类型参数的值设置为视频。
$searchResponse = $youtube->search->listSearch('id,snippet', array(
'q' => $_GET['q'],
'maxResults' => $_GET['maxResults'],
'videoCaption' => 'closedCaption',
'type' => 'video'
));
https://developers.google.com/youtube/v3/docs/search/list看到'videoCaption'? – Scuzzy
谢谢谢谢。这正是我需要的。我添加了'videoCaption'=>'closedCaption',它的工作原理! – Henry
然后,我会将我的评论移至答案中 – Scuzzy