public static async Task DownloadDanmakuAsync(string videoTitle, string videoName, long cid) { var title = videoTitle.Replace("\\", "").Replace("/", "").Replace(":", "").Replace("*", "") .Replace("?", "").Replace("\"", "").Replace("<", "").Replace(">", "").Replace("|", ""); var name = videoName.Replace("\\", "").Replace("/", "").Replace(":", "").Replace("*", "") .Replace("?", "").Replace("\"", "").Replace("<", "").Replace(">", "").Replace("|", ""); var xml = await GetDanmakuXmlAsync(cid); var fileName = $"{title} - {name}.ass"; await DanmakuHelper.MakeAssAsync(xml, fileName, Settings.DownloadPath); }
public static async Task DownloadMultiDanmakuAsync(List <BiliVideo> videoList) { var dicTask = new Dictionary <BiliVideo, Task <string> >(); foreach (var v in videoList) { dicTask.Add(v, GetDanmakuXmlAsync(v.Cid)); } var dic = new Dictionary <string, string>(); await Task.WhenAll(dicTask.Values); foreach (var item in dicTask) { var title = item.Key.Title.Replace("\\", "").Replace("/", "").Replace(":", "").Replace("*", "") .Replace("?", "").Replace("\"", "").Replace("<", "").Replace(">", "").Replace("|", ""); var name = item.Key.Name.Replace("\\", "").Replace("/", "").Replace(":", "").Replace("*", "") .Replace("?", "").Replace("\"", "").Replace("<", "").Replace(">", "").Replace("|", ""); dic.Add($"{title} - {name}.ass", item.Value.Result); } await DanmakuHelper.MakeMultiAssAsync(dic, Settings.DownloadPath); }