好吧,我可以在Youtube上传视频,但我找不到从Youtube上删除视频/视频的方法或相关代码.
private async Task Run() { UserCredential credential; using (var stream = new FileStream("client_secret.json",FileMode.Open,FileAccess.Read)) { credential = await GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets,new[] { YouTubeService.Scope.Youtube },"user",CancellationToken.None ); } var youtubeService = new YouTubeService(new BaseClientService.Initializer() { HttpClientInitializer = credential,ApplicationName = Assembly.GetExecutingAssembly().GetName().Name }); var videosDeleteRequest = youtubeService.Videos.Delete("Video ID"); await videosDeleteRequest.ExecuteAsync(); }
Error: Google.Apis.Requests.RequestError Insufficient Permission [403] Errors [ Message[Insufficient Permission] Location[ - ] Reason[insufficientPermis sions] Domain[global] ]
一点帮助或任何可能的解决方案将是非常值得注意的.
解决方法
该错误转换为:
The video that you are trying to delete cannot be deleted. The request
might not be properly authorized.
https://developers.google.com/youtube/v3/docs/videos/delete
您是否成功获得了拥有该视频的用户的令牌?