string developerKey = "--------------------------";
string username = "example@gmail.com";
string password = "@@@@";//password
YouTubeRequestSettings settings = new YouTubeRequestSettings("Videoapp", null, developerKey, username, password);
YouTubeRequest request = new YouTubeRequest(settings);
Video newvid = new Video();
Uri asdf = new Uri("http://www.youtube.com/watch?v=07rQlP66f2k");
newvid.VideoId = "07rQlP66f2k";
newvid.Rating = 5;
//request.Insert(video.RatingsUri, video); should be like this from youtube api developers guide
request.Insert(asdf, newvid);
我做错了什么?任何人都可以向我解释以及如何解决它?
答案 0 :(得分:0)
您必须先检索视频,然后才能使用以下代码添加评分:
Rating rating = new Rating();
rating.Value = 1;
newvid.YouTubeEntry.Rating = rating;
request.Service.Insert(new Uri(video.YouTubeEntry.RatingsLink.ToString()), video.YouTubeEntry);
另请注意,数字gd:rating已被弃用,并被yt:rating元素取代:
http://code.google.com/apis/youtube/2.0/developers_guide_protocol_ratings.html