1

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

我的代码有什么问题?

4

1 回答 1

1

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

于 2013-04-21T11:53:08.583 回答