データ API を使用して ASP.net Web サイトのビデオを YouTube にアップロードしようとしていますが、「リモート サーバーがエラーを返しました: (403) 許可されていません」というエラーが表示されます。
以下のコードを使用しています。
YouTubeRequestSettings settings = new YouTubeRequestSettings("VideoPortal", "Developer_Key", "ユーザー名", "パスワード"); YouTubeRequest リクエスト = 新しい YouTubeRequest(設定);
ビデオ newVideo = 新しいビデオ();
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);
このコードを機能させてエラーを解決する方法を教えてください。