【问题标题】:YouTube API, C#.net - Getting video info from YouTube failed some timesYouTube API, C#.net - 从 YouTube 获取视频信息有时失败
【发布时间】:2013-04-07 12:43:07
【问题描述】:

我正在尝试向 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;
}

我的代码有什么问题?

【问题讨论】:

    标签: c# api youtube gdata


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2013-03-03
      • 2015-04-14
      • 2012-12-14
      • 2018-04-26
      • 1970-01-01
      • 2018-06-28
      • 2013-07-10
      • 2015-08-10
      • 2020-12-28
      相关资源
      最近更新 更多