时间:2019-03-17 标签:c#app将视频上传到 YouTube

发布于 2024-12-05 20:35:47 字数 644 浏览 1 评论 0原文

我需要创建 ac# 应用程序,在其中可以将视频(我给出的视频路径为 .mp4)上传到 Youtube。

我怎样才能做到这一点?我需要在我的 Google Data .NET 客户端库项目中添加引用,并且还必须获取开发人员密钥。

为了添加参考,例如:

using Google.GData.Client; 

// I need to have a method authentificate :     
YouTubeRequestSettings settings = 
     new YouTubeRequestSettings("example app", clientID, developerKey);
YouTubeRequest request = 
     new YouTubeRequest(settings); 

此外,如果我有视频 .mp4,我是否需要有一个将其上传到 YouTube 的模型?模型这样的瓷砖,描述......?

此外,为了添加引用 suh 作为 Google Data Core API LIBRARY 我需要构建 Google Data api sdk 。为此,我需要添加对 Nunit 的引用。但目前,下载网站无法运行。我确实需要构建 sdk 才能添加对我的项目的引用,对吧?

需要帮助请

I need to create a c# application where I can upload a video ( I give the path for the video which is .mp4) to Youtube.

How can I do that? I need to add a reference in my project of Google Data .NET Client library and I also have to obtain a Developer key.

In order to add reference such as:

using Google.GData.Client; 

// I need to have a method authentificate :     
YouTubeRequestSettings settings = 
     new YouTubeRequestSettings("example app", clientID, developerKey);
YouTubeRequest request = 
     new YouTubeRequest(settings); 

Also if I have the video .mp4 do I need to have a model for uploading it on youtube? Model such Tile, Description....?

Moreover in order to add reference suh as Google Data Core API LIBRARY I need to build Google Data api sdk . In order to do that, I need to add reference to Nunit. but for moment, the download site doesn't work. I do need to build the sdk in order to add reference to my project , right?

Need help please

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

謸气贵蔟 2024-12-12 20:35:48

一旦您下载了您提到的库 Google Data .NET,这里是一个从本地文件上传视频的片段,您应该在您的应用程序中包含这样的片段。

Video newVideo = new Video();

newVideo.Title ="My Test Movie";
newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));
newVideo.Keywords = "cars, funny";
newVideo.Description = "My description";
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");

newVideo.YouTubeEntry.MediaSource = new MediaFileSource("c:\\file.mov",
  "video/quicktime");
Video createdVideo = request.Upload(newVideo);

有关详细文档和示例,请参阅官方公开的 .NET 开发人员指南: YouTube API 和工具 - 开发人员指南:.NET

once you have downloaded the library you mentioned, Google Data .NET, here is a snippet to upload a video from a local file, you should include such snippet in your application.

Video newVideo = new Video();

newVideo.Title ="My Test Movie";
newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema));
newVideo.Keywords = "cars, funny";
newVideo.Description = "My description";
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");

newVideo.YouTubeEntry.MediaSource = new MediaFileSource("c:\\file.mov",
  "video/quicktime");
Video createdVideo = request.Upload(newVideo);

For extensive documentation and samples refer to the official, public, .NET Developer's Guide: YouTube APIs and Tools - Developer's Guide: .NET

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文