c# app +上传视频到Youtube

本文关键字:视频 Youtube app | 更新日期: 2023-09-27 18:09:08

我需要创建一个c#应用程序,在那里我可以上传视频(我给视频的路径是。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上吗?模型如瓷砖,描述....?

此外,为了添加引用,如Google Data Core API LIBRARY,我需要构建Google Data API sdk。为了做到这一点,我需要添加对Nunit的引用。但目前,下载网站不起作用。我确实需要构建sdk以便向我的项目添加引用,对吗?

需要帮助吗

c# app +上传视频到Youtube

一旦你下载了你提到的库,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