public static async Task <IEnumerable <ISubtitle> > GetVideoItemSubtitlesAsync(string id) { var res = new List <ISubtitle>(); List <SubtitlePOCO> poco = await YouTubeSite.GetVideoSubtitlesByIdAsync(id).ConfigureAwait(false); res.AddRange(poco.Select(SubtitleFactory.CreateSubtitle)); if (res.Any()) { return(res); } ISubtitle chap = SubtitleFactory.CreateSubtitle(); chap.IsEnabled = false; chap.Language = "Auto"; res.Add(chap); return(res); }
private async Task FillSubtitles() { if (Subtitles.Any()) { return; } List <SubtitlePOCO> res = await YouTubeSite.GetVideoSubtitlesByIdAsync(youId).ConfigureAwait(false); if (res.Any()) { Subtitles.Clear(); foreach (ISubtitle sb in res.Select(SubtitleFactory.CreateSubtitle)) { Subtitles.Add(sb); } } }
public async Task GetVideoSubtitlesByIdAsync() { List <SubtitlePOCO> res = await YouTubeSite.GetVideoSubtitlesByIdAsync("WaEcvDnbaIc").ConfigureAwait(false); Assert.IsTrue(res.Any()); }