【问题标题】:Youtube list search with cc filter?使用 cc 过滤器搜索 Youtube 列表?
【发布时间】:2017-08-08 06:28:49
【问题描述】:

我正在使用 google-api-php-client 在 youtube 上搜索视频,并且我想过滤结果以仅返回带有字幕 (cc) 的视频。

有可能吗?如果是,我应该如何修改查询?

$searchResponse = $youtube->search->listSearch('id,snippet', array(
  'q' => $_GET['q'],
  'maxResults' => $_GET['maxResults'],
));

谢谢。

【问题讨论】:

标签: php youtube-api youtube-data-api


【解决方案1】:

https://developers.google.com/youtube/v3/docs/search/list

API 文档提到了一个videoCaption 字符串参数

videoCaption 参数指示 API 是否应根据视频搜索结果是否有字幕来过滤它们。如果为该参数指定值,则还必须将 type 参数的值设置为 video。

$searchResponse = $youtube->search->listSearch('id,snippet', array(
  'q' => $_GET['q'],
  'maxResults' => $_GET['maxResults'],
  'videoCaption' => 'closedCaption',
  'type' => 'video'
));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-23
    • 1970-01-01
    • 2017-04-02
    • 2015-12-19
    • 2019-02-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-21
    相关资源
    最近更新 更多