如何使用 C# 中的 Youtube API 将视频上传到 YouYube?
下面的代码失败了?可能是什么问题?
YouTubeRequestSettings settings = new YouTubeRequestSettings("whatwill come here ?",
"my api key",
"my youtube login email", "my youtube login password");
YouTubeRequest request = new YouTubeRequest(settings);
Video newVideo = new Video();
newVideo.Title = "test 1";
newVideo.Tags.Add(new MediaCategory("Gaming", YouTubeNameTable.CategorySchema));
newVideo.Keywords = "test 1 , test 2";
newVideo.Description = "test 3 test 4";
newVideo.YouTubeEntry.Private = false;
newVideo.Tags.Add(new MediaCategory("tag 1, tag 2",
YouTubeNameTable.DeveloperTagSchema));
newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);
newVideo.YouTubeEntry.MediaSource = new MediaFileSource("C:\\test.avi", "video/quicktime");
Video createdVideo = request.Upload(newVideo);
我解决了这个问题。这是我的类别:该类别必须是游戏,而不是游戏。
The code below fails? What might be the problem?
YouTubeRequestSettings settings = new YouTubeRequestSettings("whatwill come here ?",
"my api key",
"my youtube login email", "my youtube login password");
YouTubeRequest request = new YouTubeRequest(settings);
Video newVideo = new Video();
newVideo.Title = "test 1";
newVideo.Tags.Add(new MediaCategory("Gaming", YouTubeNameTable.CategorySchema));
newVideo.Keywords = "test 1 , test 2";
newVideo.Description = "test 3 test 4";
newVideo.YouTubeEntry.Private = false;
newVideo.Tags.Add(new MediaCategory("tag 1, tag 2",
YouTubeNameTable.DeveloperTagSchema));
newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122);
newVideo.YouTubeEntry.MediaSource = new MediaFileSource("C:\\test.avi", "video/quicktime");
Video createdVideo = request.Upload(newVideo);
I solved the problem. It was my category: the category has to be Games instead of Gaming.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题出在您的“游戏”类别上。将您的
MediaCategory
构造函数修改为以下内容:它应该适合您。
The problem is with your "Gaming" category. Amend your
MediaCategory
constructor to the following:and it should work for you.