1
votes

I'm trying to add comment to videos on YouTube , some times when I'm getting a video to add comment on it, YouTube send me the below error: Execution of request failed: http://gdata.youtube.com/feeds/api/videos/ceVlltPBcHg/comments

The inner message of the exception is: "The remote server returned an error: (403) Forbidden."

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;
}

What is wrong in my code?

1

1 Answers

1
votes

It seems google's qouta security rules return error to my code. Code works correctly when I use the code in long intervals.