c# - YouTube API,C#.net-从YouTube获取视频信息有时失败

标签 c# api youtube gdata

我试图在YouTube上的视频中添加评论,有时,当我要在视频中添加评论时,YouTube向我发送以下错误:
请求执行失败:http://gdata.youtube.com/feeds/api/videos/ceVlltPBcHg/comments

异常的内部消息是:“远程服务器返回错误:(403)禁止。”

public bool commentVideo(string videoId)
{
       Uri Url = new Uri("http://gdata.youtube.com/feeds/api/videos/" + videoId);
       YouTubeRequestSettings s = new YouTubeRequestSettings(AppName, ApiKey,UserName,
                                                                  Password);
       s.Timeout = 10000000;
       YouTubeRequest account  = new YouTubeRequest(s);
       account.Proxy = GetProxyForUser(user);
       Video video = account.Retrieve<Video>(Url);//some times got exception
       string rating = commentRepository.getRating();
       Comment c = new Comment();
       c.Content = commentRepository.getComment();
       account.AddComment(video, c);
       Console.WriteLine("Comment successfully added to : " + videoId);
       return true;
}

我的代码有什么问题?

最佳答案

看来Google的qouta安全规则将错误返回给我的代码。当我长时间使用代码时,代码可以正常工作。

关于c# - YouTube API,C#.net-从YouTube获取视频信息有时失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16014545/

相关文章:

javascript - 如何通过 BootstrapVue 仅使用 API 中所需的字段?

android - 在android中制作像You-Tube一样的自定义抽屉导航

php - YouTube v3 API 上传到 channel

Google Distance Matrix API 中距离计算背后的算法

ios - 在 UIWebview Swift 中居中嵌入的 youtube 视频

c# - C# 中的重载运算符实际上是好的做法吗?

c# - 从 C# 访问 Win32 C/C++ 结构成员

c# - 从System.Web.HttpInputStream获取文件信息

c# - JSON 解析错误 : Missing a name for object member

java - Java 客户端库 (AdWords) 的关键字迭代器