使用YouTube API v3搜索我的视频时,invalidSearchFilter [英] invalidSearchFilter when searching my videos using YouTube api v3

查看:87
本文介绍了使用YouTube API v3搜索我的视频时,invalidSearchFilter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用YouTube API v3时,我不断收到invalidSearchFilter错误.我有以下参数:

I keep getting invalidSearchFilter error when using YouTube API v3. I have the following params:

part: snippet
q: testtag
forMine: true
type: video

我正在使用API​​运动场,并注意到,如果我进行OAuth调用,它将可以使用,但是仅使用API​​密钥(不使用OAuth即可执行),它将失败.我的代码中发生了同样的事情.基本列表调用在这两种方法中均有效,因此我怀疑它们的API中有错误,或者我丢失了某些东西.

I am using the API playground, and noticed that if I do an OAuth call, it will work, but with just the API key (Execute without OAuth), it fails. Same thing happens in my code. A basic list call works in both, so I am suspecting a bug in their API, or I'm missing something.

其他任何人都可以确认一下,看看我是否缺少任何东西吗?

Can anyone else confirm this to see if I'm missing something?

如果我不使用forMine并输入params,它就可以工作,但是它会在全局范围内进行搜索,这不是我想要的.

It works if I leave off the forMine and type params, but then it searches globally, which is not what I want.

我已经进行了搜索,发现的其他其他参考都与未设置类型参数有关,但我已对其进行了设置.

I have searched for this, and the only other references I've found have been related to not setting the type param, but I have it set.

我发现此链接暗示了可能的API错误:

I found this link which suggests a possible API bug: youtube v3 api error when searching with forMine set to false

推荐答案

文档是您的朋友

forMine布尔值
此参数只能在适当的情况下使用 授权请求. forMine参数将搜索限制为仅 检索经过身份验证的用户拥有的视频.如果您设定这个 参数为true,则类型参数的值也必须设置为 视频.

forMine boolean
This parameter can only be used in a properly authorized request. The forMine parameter restricts the search to only retrieve videos owned by the authenticated user. If you set this parameter to true, then the type parameter's value must also be set to video.

所以是的,您缺少了只能使用 forMime的部分类型参数和授权请求.使用Api密钥是您访问公共API的未经授权的请求.如果您未通过身份验证,您认为如何能够搜索您的视频?它不知道你是谁.

So yes you are missing something the part where you can only use forMime type parameter with authorized requests. Using an Api key is an unauthorized request you are accessing the public API. How do you think it would be able to search videos that yours if you aren't authenticated? It doesn't know who you are.

这篇关于使用YouTube API v3搜索我的视频时,invalidSearchFilter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆