youtube api 评级不起作用?

发布于 2024-11-13 12:13:24 字数 799 浏览 2 评论 0原文

  string developerKey = "--------------------------";

    string username = "[email protected]";
    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);

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

  string developerKey = "--------------------------";

    string username = "[email protected]";
    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);

what am I doing wrong? Can anyone explain to me and how to do fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幼儿园老大 2024-11-20 12:13:24

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

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

You have to retrieve the video first and then you can use the following code to add a rating:

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

Please also note that the numeric gd:rating has been deprecated and replaced by the yt:rating element:

http://code.google.com/apis/youtube/2.0/developers_guide_protocol_ratings.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文