0
  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);

我究竟做错了什么?谁能向我解释以及如何解决它?

4

1 回答 1

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

于 2011-08-02T00:25:48.923 回答