【问题标题】:Upload video fail to youtube from asp.net website by data api通过数据 api 从 asp.net 网站上传视频到 youtube 失败
【发布时间】:2013-04-23 11:04:54
【问题描述】:

我正在尝试使用数据 API 将 ASP.net 网站中的视频上传到 YouTube,但我收到此错误:“远程服务器返回错误:(403) Forbidden。”

我正在使用以下代码:

YouTubeRequestSettings settings = new YouTubeRequestSettings("VideoPortal", "Developer_Key", "username", "password"); YouTubeRequest 请求 = 新的 YouTubeRequest(设置);

视频 newVideo = new Video();

        newVideo.Title = "testvideo";//txttitle.Text.Trim();
        newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));
        newVideo.Keywords = "testvideo";//txtkeyword.Text.Trim();
        newVideo.Description = "testvideodesc";//txtdesc.Text.Trim();
        newVideo.YouTubeEntry.Private = false;
        newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag",
          YouTubeNameTable.DeveloperTagSchema));

        newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);
        // alternatively, you could just specify a descriptive string
        // newVideo.YouTubeEntry.setYouTubeExtension("location", "Mountain View, CA");
        string path = Server.MapPath("video/Screen-Recording.mov");
        newVideo.YouTubeEntry.MediaSource = new MediaFileSource(path,
          "video/quicktime");
        settings.Timeout = 100000000;
        Video createdVideo = request.Upload(newVideo);

任何人都可以向我建议如何使此代码正常工作并解决错误吗?

【问题讨论】:

    标签: asp.net youtube


    【解决方案1】:

    当您返回 HTTP 403 响应时,HTTP 响应正文的内容是什么?响应正文中应该有一条错误消息,解释出了什么问题

    【讨论】:

      猜你喜欢
      • 2015-09-20
      • 1970-01-01
      • 1970-01-01
      • 2019-05-21
      • 2014-09-27
      • 2012-05-21
      • 2014-05-09
      • 2014-02-20
      • 2012-08-19
      相关资源
      最近更新 更多