gpt4 book ai didi

c# - Youtube API 无效搜索查询 invalidSearchFilter 错误

转载 作者:行者123 更新时间:2023-12-03 05:31:32 24 4
gpt4 key购买 nike

我正在尝试通过 YouTube API 访问我的私有(private)视频。
当我的应用程序执行请求时,我目前收到错误消息

“请求包含无效的搜索过滤器和/或限制组合。请注意,如果您为 eventType、videoCaption、videoCategoryId、videoDefinition、videoDimension、videoDuration、videoEmbeddable、videoLicense、videoSyndicated 设置值,则必须将 type 参数设置为 video或 videoType 参数。”

我已将 ForMine 设置为 true 并将 Type 属性设置为 video,所以我不确定它为什么不起作用。

请求我从 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: truetype: video没有 ChannelID或把 ChannelIDtype: video没有 forMine .

希望能帮助到你。

关于c# - Youtube API 无效搜索查询 invalidSearchFilter 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42185318/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com