public static void GetPic(BiliInterfaceInfo info) { string avnum = info.AVNUM; string file = Environment.CurrentDirectory + @"\pic\" + avnum + ".jpg"; if (File.Exists(file)) { Log.Info("封面已存在 - " + avnum); } else { if (info.pic != null) { string url = info.pic; Log.Info("正在获取封面 - " + info.AVNUM + " | " + url + " -> " + file); TSDownload tsd = new TSDownload(url, file); tsd.StartWithoutThread(); } } }
public static void GetPic(string AVnum) { string avnum = GetAVdenum(AVnum); string file = Environment.CurrentDirectory + @"\pic\AV" + avnum + ".jpg"; if (File.Exists(file)) { Log.Info("封面已存在 - AV" + avnum); } else { BiliInterfaceInfo info = GetInfo(AVnum); if (info.pic != null) { string url = info.pic; Log.Info("正在获取封面 - " + info.AVNUM + " | " + url + " -> " + file); TSDownload tsd = new TSDownload(url, file); tsd.Start(); } } }
public static void GetFace(BiliInterfaceInfo info) { if (!string.IsNullOrEmpty(info.face)) { string filename = GetFaceFilename(info); string file = Environment.CurrentDirectory + @"\pic\" + filename; if (File.Exists(file)) { Log.Info("头像已存在 - " + filename); } else { Log.Info("正在获取头像 - " + info.AVNUM + " | " + info.face + " -> " + file); TSDownload tsd = new TSDownload(info.face, file); tsd.StartWithoutThread(); } } else { Log.Warn("没有头像地址,请重新获取 - " + info.AVNUM); } }
public static IEnumerable <string> GetAVFlvUrl(string AVnum, out IEnumerable <string> renames, List <BiliInterfaceInfo> binfos = null) //TODO: 试试元组 { string[] avnp = Regex.Split(AVnum, "_|-|#"); string avnum = GetAVdenum(avnp[0]); int page = 1; if (avnp.Length > 1) { try { page = int.Parse(avnp[1]); } catch { Log.Warn(AVnum + " - 无法识别分P编号,将下载P1"); } } BiliInterfaceInfo info = null; IEnumerable <string> flvs = null; List <string> rrnames = new List <string>(); try { info = GetInfo(avnum); if (page > 1) { if (info.pagesn.Count >= page) { flvs = GetFlvUrls(uint.Parse(info.pagesn[page - 1].cid)); } else { Log.Warn(AVnum + $" - 目标视频仅有{info.pagesn.Count}P,将下载P1"); flvs = GetFlvUrls(info.cid); } } else { flvs = GetFlvUrls(info.cid); } string topstring = ""; try { if (binfos != null) { int paiming = (from b in binfos where b.avnum == info.avnum select b.Fpaiming.Value).First(); if (paiming != 0 && paiming <= 20) { topstring = "TOP_" + paiming + "-"; } } } catch { } info.title = $"{info.title}_{info.avnum}_P{page}_{info.pagesn[page - 1].part}"; info.title = TSDownload.removeInvChrInPath(info.title); for (int i = 0; i < flvs.Count(); i++) { string filename = Path.GetFileName(new Uri(flvs.ElementAt(i)).AbsolutePath); rrnames.Add($"{filename}$///${topstring}{info.title}_{i + 1}.flv"); } } catch (Exception e) { Log.Error("AV" + avnum + "的数据发生错误,请稍后重试!" + e.Message); } renames = rrnames; return(flvs); }