有this文檔。可用。所以我用如何使用C#的Youtube API登錄程序?
YouTubeRequestSettings settings = new YouTubeRequestSettings("Appname","devkey", textBox1.Text, textBox2.Text);
request = new YouTubeRequest(settings);
Video newVideo = new Video();
newVideo.Title = "Test";
newVideo.Tags.Add(new MediaCategory("Animals", YouTubeNameTable.CategorySchema));
newVideo.Description = "Testing Testing Testing";
newVideo.YouTubeEntry.Private = false;
newVideo.YouTubeEntry.MediaSource = new MediaFileSource("C:\\BabyBoyScenesBackground_PAL.wmv", "video/x-ms-wmv");
try
{
request.Upload(newVideo);
}
catch (Exception ccc)
{
MessageBox.Show(ccc.ToString());
}
只是爲了獲得401未經授權。我需要改變什麼。如果你問,我發現的所有來源都是過時的,或者人們沒有處理這個問題。
對於「Appname」,「devkey」,我使用了適當的值以及pw和用戶名。
您是否缺少'YouTubeRequestSettings'中的clientId參數或者此方法是否有重載? –
Google.YouTube.YouTubeRequestSettings不包含帶5個參數的構造函數,其中包含clientid。其實沒有構造函數包含clientid了。我讀過它已被棄用。 – Zurechtweiser
它需要clientId參數。 http://google-gdata.googlecode.com/svn-history/r902/docs/folder56/M_Google_YouTube_YouTubeRequestSettings__ctor_2.htm – prashanth