Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string YouTubeDeveloperKey = ConfigurationManager.AppSettings["API_KEY"];
- string YouTubeCompany = ConfigurationManager.AppSettings["YouTubeCompany"];
- string YoutubeUserName = ConfigurationManager.AppSettings["YoutubeUserName"];
- string YoutubePassword = ConfigurationManager.AppSettings["YoutubePassword"];
- try
- {
- YouTubeRequestSettings settings = new YouTubeRequestSettings(YouTubeCompany,YouTubeDeveloperKey, YoutubeUserName, YoutubePassword);
- settings.Timeout = 1000000000;
- YouTubeRequest request = new YouTubeRequest(settings);
- Video newVideo = new Video();
- newVideo.Title = Convert.ToString(Session["Title"]);
- newVideo.Tags.Add(new MediaCategory("Autos",YouTubeNameTable.CategorySchema));
- newVideo.Keywords = Convert.ToString(Session["Title"]);
- newVideo.Description = Convert.ToString(Session["Title"]) + DateTime.Now.ToString("dd_mm_yyyy_hh_mm_ss");
- newVideo.YouTubeEntry.Private = false;
- newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag",
- YouTubeNameTable.DeveloperTagSchema));
- newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);
- FormUploadToken token = request.CreateFormUploadToken(newVideo);
- HttpContext.Current.Session["form_upload_url"] = token.Url;
- HttpContext.Current.Session["form_upload_token"] = token.Token;
- string page = "http://" + Request.ServerVariables["SERVER_NAME"];
- if (Request.ServerVariables["SERVER_PORT"] != "80")
- {
- page += ":" + Request.ServerVariables["SERVER_PORT"];
- }
- if (Request.ServerVariables["SERVER_NAME"].ToString().C`enter code here`ontains("localhost"))
- page += "/web/Admin/Gallery.aspx";
- else
- page += "/Admin/Gallery.aspx";
- // Response.Write(page);
- HttpContext.Current.Session["form_upload_redirect"] = page;
- Submit();
- }
- catch (Exception ex)
- {
- Response.Write(YouTubeDeveloperKey + " " + YouTubeCompany + " " + YoutubeUserName + " " + YoutubePassword);
- Response.Write(ex.Message);
- }
- enter code here`enter code here`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement