Advertisement
Guest User

Untitled

a guest
Dec 15th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. string YouTubeDeveloperKey = ConfigurationManager.AppSettings["API_KEY"];
  2. string YouTubeCompany = ConfigurationManager.AppSettings["YouTubeCompany"];
  3. string YoutubeUserName = ConfigurationManager.AppSettings["YoutubeUserName"];
  4. string YoutubePassword = ConfigurationManager.AppSettings["YoutubePassword"];
  5. try
  6. {
  7. YouTubeRequestSettings settings = new YouTubeRequestSettings(YouTubeCompany,YouTubeDeveloperKey, YoutubeUserName, YoutubePassword);
  8. settings.Timeout = 1000000000;
  9. YouTubeRequest request = new YouTubeRequest(settings);
  10. Video newVideo = new Video();
  11. newVideo.Title = Convert.ToString(Session["Title"]);
  12. newVideo.Tags.Add(new MediaCategory("Autos",YouTubeNameTable.CategorySchema));
  13. newVideo.Keywords = Convert.ToString(Session["Title"]);
  14. newVideo.Description = Convert.ToString(Session["Title"]) + DateTime.Now.ToString("dd_mm_yyyy_hh_mm_ss");
  15. newVideo.YouTubeEntry.Private = false;
  16. newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag",
  17. YouTubeNameTable.DeveloperTagSchema));
  18. newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);
  19. FormUploadToken token = request.CreateFormUploadToken(newVideo);
  20. HttpContext.Current.Session["form_upload_url"] = token.Url;
  21. HttpContext.Current.Session["form_upload_token"] = token.Token;
  22. string page = "http://" + Request.ServerVariables["SERVER_NAME"];
  23. if (Request.ServerVariables["SERVER_PORT"] != "80")
  24. {
  25. page += ":" + Request.ServerVariables["SERVER_PORT"];
  26. }
  27.  
  28. if (Request.ServerVariables["SERVER_NAME"].ToString().C`enter code here`ontains("localhost"))
  29. page += "/web/Admin/Gallery.aspx";
  30. else
  31. page += "/Admin/Gallery.aspx";
  32.  
  33. // Response.Write(page);
  34.  
  35. HttpContext.Current.Session["form_upload_redirect"] = page;
  36.  
  37. Submit();
  38. }
  39. catch (Exception ex)
  40. {
  41. Response.Write(YouTubeDeveloperKey + " " + YouTubeCompany + " " + YoutubeUserName + " " + YoutubePassword);
  42. Response.Write(ex.Message);
  43. }
  44. enter code here`enter code here`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement