示例#1
0
        public static YouTubeRequest GetRequest1()
        {
            YouTubeRequestSettings settings = new YouTubeRequestSettings("LifeTube",
                                  ConfigurationManager.AppSettings["YouTubeAPIKey"],
                                  ConfigurationManager.AppSettings["YouTubeUsername"],
                                  ConfigurationManager.AppSettings["YouTubePassword"]);

            YouTubeRequest request = new YouTubeRequest(settings);
            Google.YouTube.Video newVideo = new Google.YouTube.Video();

            newVideo.Title = "My first Movie";
            newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));
            newVideo.Keywords = "cars, funny";
            newVideo.Description = "My description";
            newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag", YouTubeNameTable.DeveloperTagSchema));
            newVideo.YouTubeEntry.Private = false;

            newVideo.YouTubeEntry.setYouTubeExtension("location", "Somerville, MA");
            var token = request.CreateFormUploadToken(newVideo);
            var strToken = token.Token;
            var strFormAction = token.Url + "?nexturl=http://[ LifeTube ]/form/post-video-step2.aspx?Complete=1";

            //Session["YTRequest"] = request;

            return request;
            //return View(request);
        }
 public FormUploadToken addMetadata(String title, String description, String keyword)
 {
     String developerKey = "AI39si5IOTNaonIFeiHdJxhJQy3oNC-fB1I_9w4TMeGQ3SOTyf59bNvHh2IRKvqDIHQRGMC_PIfRpJuq_bwkFPauyXQWY9T1nQ";
     String username = "******";
     String pwd = "cmsgecg28";
     YouTubeRequestSettings settings = new YouTubeRequestSettings("cms_app", developerKey, username, pwd);
     YouTubeRequest request = new YouTubeRequest(settings);
     Video newVideo = new Video();
     newVideo.Title = title;
     newVideo.Tags.Add(new MediaCategory("Education", YouTubeNameTable.CategorySchema));
     newVideo.Keywords = keyword;
     newVideo.Description = description;
     newVideo.YouTubeEntry.Private = false;
     newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);
     newVideo.Tags.Add(new MediaCategory("CMS, GECG28", YouTubeNameTable.DeveloperTagSchema));
     FormUploadToken token = request.CreateFormUploadToken(newVideo);
     return token;
 }