private async Task Run(string fileName) { UserCredential credential; using (var stream = new FileStream(@"C:\CredsFolder\youtube_uploader_client_secrets.json", FileMode.Open, FileAccess.Read)) { credential = await GoogleWebAuthorizationBroker.AuthorizeAsync( GoogleClientSecrets.Load(stream).Secrets, // This OAuth 2.0 access scope allows an application to upload files to the // authenticated user's YouTube channel, but doesn't allow other types of access. new[] { YouTubeService.Scope.YoutubeUpload }, "*****@*****.**", CancellationToken.None ); } var youtubeService = new YouTubeService(new BaseClientService.Initializer() { HttpClientInitializer = credential, ApplicationName = Assembly.GetExecutingAssembly().GetName().Name }); var video = new Video(); video.Snippet = new VideoSnippet(); var videoDate = ParseVideoDate(fileName); string title = $"COINBASE PRO - {videoDate}"; var description = $"Data Video for AI Machine Learning Training Bot - COINBASE PRO recording on {videoDate}"; video.Snippet.Title = title; // "Default Video Title"; video.Snippet.Description = description; // "Default Video Description"; video.Snippet.Tags = new string[] { "Coinbase", "Coinbase Pro" }; var category = CategoryCollection.GetByName("Science & Technology"); video.Snippet.CategoryId = $"{category.id}"; //"22"; // See https://developers.google.com/youtube/v3/docs/videoCategories/list video.Status = new VideoStatus(); video.Status.PrivacyStatus = PrivacyStatus.Unlisted; // "unlisted"; // or "private" or "public" var filePath = fileName; // @"REPLACE_ME.mp4"; // Replace with path to actual movie file. TotalSize = new FileInfo(fileName).Length; using (var fileStream = new FileStream(filePath, FileMode.Open)) { var videosInsertRequest = youtubeService.Videos.Insert(video, "snippet,status", fileStream, "video/*"); videosInsertRequest.ProgressChanged += videosInsertRequest_ProgressChanged; videosInsertRequest.ResponseReceived += videosInsertRequest_ResponseReceived; await videosInsertRequest.UploadAsync(); } }