1

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

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

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

请求我从提琴手发送到 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();

任何帮助将不胜感激,谢谢!

4

1 回答 1

1

要么放forMine: trueand type: videowithoutChannelID要么放ChannelIDand type: videowithout forMine

希望能帮助到你。

于 2017-02-12T12:26:17.727 回答