Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
YouTube API v3搜索-don';不要返回所有视频_Api_Search_Youtube_Youtube Api - Fatal编程技术网

YouTube API v3搜索-don';不要返回所有视频

YouTube API v3搜索-don';不要返回所有视频,api,search,youtube,youtube-api,Api,Search,Youtube,Youtube Api,我正在使用YouTube API v3,这是我的问题: 例如,本视频: 于2013-04-02T11:40:24.000Z发布 当我尝试使用以下搜索引擎搜索这部电影时: https://www.googleapis.com/youtube/v3/search?part=snippet&order=date&key=MY_KEY&publishedAfter=2013-04-02T11:40:20.000Z&publishedBefore=2013-04-02T1

我正在使用YouTube API v3,这是我的问题:

例如,本视频:

于2013-04-02T11:40:24.000Z发布

当我尝试使用以下搜索引擎搜索这部电影时:

https://www.googleapis.com/youtube/v3/search?part=snippet&order=date&key=MY_KEY&publishedAfter=2013-04-02T11:40:20.000Z&publishedBefore=2013-04-02T11:40:30.000Z
此搜索没有结果,为什么?

基本上,“publishedBefore”和“PublishedBeter”不是真正的搜索参数,但更像是应用于搜索结果的过滤器。如果您的API调用只包含这两个参数,那么就没有任何搜索依据。请注意,通过此调用:

https://www.googleapis.com/youtube/v3/search?part=snippet&order=date&q=movies&key=MY_KEY&publishedBefore=2013-04-02T11:40:24.300Z&publishedAfter=2013-04-02T11:40:20.000Z
返回单个视频。本质上,省略'q'参数就像告诉YouTube搜索空字符串。

基本上,“publishedBefore”和“publishedAfter”不是真正的搜索参数,而是更像是应用于搜索结果的过滤器。如果您的API调用只包含这两个参数,那么就没有任何搜索依据。请注意,通过此调用:

https://www.googleapis.com/youtube/v3/search?part=snippet&order=date&q=movies&key=MY_KEY&publishedBefore=2013-04-02T11:40:24.300Z&publishedAfter=2013-04-02T11:40:20.000Z

返回单个视频。本质上,省略“q”参数就像告诉YouTube搜索空字符串。

但在q中,parametr被列为可选参数。每个字符串中都有空字符串,所以当我没有指定q参数时,它应该返回每个视频。我错了吗?这是可选的,因为如果不包含错误,就不会出现错误。但不指定q参数并不意味着“全部返回”,正如提交空白谷歌搜索并不意味着“全部返回网页”。有很好的理由可以让您忽略“q”参数。。。例如,您可以改为执行channelId或topicId搜索。但不幸的是,YouTube的算法并没有像你所希望的那样真正具备基于日期的搜索功能。但在q中,parametr被列为可选参数。每个字符串中都有空字符串,所以当我没有指定q参数时,它应该返回每个视频。我错了吗?这是可选的,因为如果不包含错误,就不会出现错误。但不指定q参数并不意味着“全部返回”,正如提交空白谷歌搜索并不意味着“全部返回网页”。有很好的理由可以让您忽略“q”参数。。。例如,您可以改为执行channelId或topicId搜索。但不幸的是,YouTube的算法并没有像你所希望的那样真正具备基于日期的搜索功能。