C# youtube api评级不起作用?

C# youtube api评级不起作用?,c#,asp.net,youtube-api,youtube.net-api,C#,Asp.net,Youtube Api,Youtube.net Api,我做错了什么?有人能向我解释一下如何修复它吗?您必须先检索视频,然后使用以下代码添加评级: string developerKey = "--------------------------"; string username = "example@gmail.com"; string password = "@@@@";//password YouTubeRequestSettings settings = new YouTubeRequestSettings("

我做错了什么?有人能向我解释一下如何修复它吗?

您必须先检索视频,然后使用以下代码添加评级:

  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);
还请注意,数字gd:rating已被弃用,并被yt:rating元素替换:

Rating rating = new Rating();
rating.Value = 1;
newvid.YouTubeEntry.Rating = rating;
request.Service.Insert(new Uri(video.YouTubeEntry.RatingsLink.ToString()), video.YouTubeEntry);