Youtube API 无效的搜索查询 invalidSearchFilter 错误
Youtube API invalid search query invalidSearchFilter error
我正在尝试通过 YouTube API 访问我的私人视频。
当我的应用执行
请求时,我目前遇到错误
"The request contains an invalid combination of search filters and/or restrictions. Note that you must set the type parameter to video if you set a value for the eventType, videoCaption, videoCategoryId, videoDefinition, videoDimension, videoDuration, videoEmbeddable, videoLicense, videoSyndicated, or videoType parameters."
我已将 ForMine 设置为 true 并将类型 属性 设置为视频,所以我不确定为什么它不起作用。
我从 fiddler 发送到 Youtube 的请求:
GET /youtube/v3/search?part=snippet&channelId=XXXXXX&forMine=True&maxResults=1&order=date&type=video HTTP/1.1
User-Agent: Youtube Sample google-api-dotnet-client/1.21.0.0 (gzip)
Authorization: XXXXX
Host: www.googleapis.com
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
和代码:
string[] scopes =
{
YouTubeService.Scope.YoutubeReadonly
};
try
{
var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets { ClientId = clientId, ClientSecret = clientSecret }
, scopes
, "user"
, CancellationToken.None
, new FileDataStore("Youtube.Auth.Store")).Result;
var youtubeService = new YouTubeService(new BaseClientService.Initializer
{
HttpClientInitializer = credential,
ApplicationName = "Youtube Sample"
});
var searchListRequest = youtubeService.Search.List("snippet");
searchListRequest.MaxResults = 1;
searchListRequest.Type = "video";
searchListRequest.ForMine = true;
searchListRequest.Order = SearchResource.ListRequest.OrderEnum.Date;
searchListRequest.ChannelId = "XXXXX";
var searchListResponse = searchListRequest.Execute();
任何帮助将不胜感激,谢谢!
要么将 forMine: true
和 type: video
不带 ChannelID
,要么将 ChannelID
和 type: video
不带 forMine
。
希望对您有所帮助。
我正在尝试通过 YouTube API 访问我的私人视频。 当我的应用执行
请求时,我目前遇到错误"The request contains an invalid combination of search filters and/or restrictions. Note that you must set the type parameter to video if you set a value for the eventType, videoCaption, videoCategoryId, videoDefinition, videoDimension, videoDuration, videoEmbeddable, videoLicense, videoSyndicated, or videoType parameters."
我已将 ForMine 设置为 true 并将类型 属性 设置为视频,所以我不确定为什么它不起作用。
我从 fiddler 发送到 Youtube 的请求:
GET /youtube/v3/search?part=snippet&channelId=XXXXXX&forMine=True&maxResults=1&order=date&type=video HTTP/1.1
User-Agent: Youtube Sample google-api-dotnet-client/1.21.0.0 (gzip)
Authorization: XXXXX
Host: www.googleapis.com
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
和代码:
string[] scopes =
{
YouTubeService.Scope.YoutubeReadonly
};
try
{
var credential = GoogleWebAuthorizationBroker.AuthorizeAsync(new ClientSecrets { ClientId = clientId, ClientSecret = clientSecret }
, scopes
, "user"
, CancellationToken.None
, new FileDataStore("Youtube.Auth.Store")).Result;
var youtubeService = new YouTubeService(new BaseClientService.Initializer
{
HttpClientInitializer = credential,
ApplicationName = "Youtube Sample"
});
var searchListRequest = youtubeService.Search.List("snippet");
searchListRequest.MaxResults = 1;
searchListRequest.Type = "video";
searchListRequest.ForMine = true;
searchListRequest.Order = SearchResource.ListRequest.OrderEnum.Date;
searchListRequest.ChannelId = "XXXXX";
var searchListResponse = searchListRequest.Execute();
任何帮助将不胜感激,谢谢!
要么将 forMine: true
和 type: video
不带 ChannelID
,要么将 ChannelID
和 type: video
不带 forMine
。
希望对您有所帮助。