示例#1
0
 private static void DownloadCaptionsForLanguage(IYoutubeClient client, IReadOnlyList <ClosedCaptionTrackInfo> closedCaptionTrackInfos, string languageCode, string downloadFolder, string videoFileNameBase, IProgress <double> progress)
 {
     closedCaptionTrackInfos
     .SingleOrDefault(info => !info.IsAutoGenerated && info.Language.Code == languageCode)
     .Do(closedCaptionTrackInfo =>
     {
         Console.WriteLine();
         Console.WriteLine($"  0.00% \t{closedCaptionTrackInfo.Language} captions");
         Console.SetCursorPosition(0, Console.CursorTop - 1);
         client.DownloadClosedCaptionTrackAsync(closedCaptionTrackInfo,
                                                Path.Combine(downloadFolder, $"{videoFileNameBase}.{languageCode}.srt"),
                                                progress)
         .Wait();
     });
 }