From 3a9d2f1828a94b5a62fbff505e83a036e6c08151 Mon Sep 17 00:00:00 2001 From: yukinotech Date: Fri, 27 May 2022 05:00:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6):=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=8A=E4=BC=A0=E8=80=85=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=EF=BC=8Cmid=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBDown.Core/Entity/Entity.cs | 19 +++++++++++++++++++ BBDown.Core/Fetcher/FavListFetcher.cs | 4 +++- BBDown.Core/Fetcher/MediaListFetcher.cs | 6 +++++- BBDown.Core/Fetcher/NormalInfoFetcher.cs | 10 +++++++++- BBDown.Core/Fetcher/SeriesListFetcher.cs | 6 +++++- BBDown/Program.cs | 6 +++++- README.md | 4 ++++ 7 files changed, 50 insertions(+), 5 deletions(-) diff --git a/BBDown.Core/Entity/Entity.cs b/BBDown.Core/Entity/Entity.cs index ffff35b67..8fe6f115e 100644 --- a/BBDown.Core/Entity/Entity.cs +++ b/BBDown.Core/Entity/Entity.cs @@ -17,6 +17,8 @@ public class Page public string res; public string cover; public string desc; + public string ownerName; + public string ownerMid; public List points = new List(); public Page(int index, string aid, string cid, string epid, string title, int dur, string res) @@ -55,6 +57,21 @@ public Page(int index, string aid, string cid, string epid, string title, int du this.desc = desc; } + public Page(int index, string aid, string cid, string epid, string title, int dur, string res, string cover, string desc, string ownerName, string ownerMid) + { + this.aid = aid; + this.index = index; + this.cid = cid; + this.epid = epid; + this.title = title; + this.dur = dur; + this.res = res; + this.cover = cover; + this.desc = desc; + this.ownerName = ownerName; + this.ownerMid = ownerMid; + } + public Page(int index, Page page) { this.index = index; @@ -65,6 +82,8 @@ public Page(int index, Page page) this.dur = page.dur; this.res = page.res; this.cover = page.cover; + this.ownerName = page.ownerName; + this.ownerMid = page.ownerMid; } public override bool Equals(object obj) diff --git a/BBDown.Core/Fetcher/FavListFetcher.cs b/BBDown.Core/Fetcher/FavListFetcher.cs index 6759af27c..24077df7f 100644 --- a/BBDown.Core/Fetcher/FavListFetcher.cs +++ b/BBDown.Core/Fetcher/FavListFetcher.cs @@ -83,7 +83,9 @@ public async Task FetchAsync(string id) m.GetProperty("duration").GetInt32(), "", m.GetProperty("cover").ToString(), - m.GetProperty("intro").ToString()); + m.GetProperty("intro").ToString(), + m.GetProperty("upper").GetProperty("name").ToString(), + m.GetProperty("upper").GetProperty("mid").ToString()); if (!pagesInfo.Contains(p)) pagesInfo.Add(p); } } diff --git a/BBDown.Core/Fetcher/MediaListFetcher.cs b/BBDown.Core/Fetcher/MediaListFetcher.cs index ce4e857fc..6639beb60 100644 --- a/BBDown.Core/Fetcher/MediaListFetcher.cs +++ b/BBDown.Core/Fetcher/MediaListFetcher.cs @@ -44,6 +44,8 @@ public async Task FetchAsync(string id) { var pageCount = m.GetProperty("page").GetInt32(); var desc = m.GetProperty("intro").GetString(); + var ownerName = m.GetProperty("upper").GetProperty("name").ToString(); + var ownerMid = m.GetProperty("upper").GetProperty("mid").ToString(); foreach (var page in m.GetProperty("pages").EnumerateArray()) { Page p = new Page(index++, @@ -54,7 +56,9 @@ public async Task FetchAsync(string id) page.GetProperty("duration").GetInt32(), page.GetProperty("dimension").GetProperty("width").ToString() + "x" + page.GetProperty("dimension").GetProperty("height").ToString(), m.GetProperty("cover").ToString(), - desc); + desc, + ownerName, + ownerMid); if (!pagesInfo.Contains(p)) pagesInfo.Add(p); else index--; } diff --git a/BBDown.Core/Fetcher/NormalInfoFetcher.cs b/BBDown.Core/Fetcher/NormalInfoFetcher.cs index dec283905..14fc64cd2 100644 --- a/BBDown.Core/Fetcher/NormalInfoFetcher.cs +++ b/BBDown.Core/Fetcher/NormalInfoFetcher.cs @@ -22,6 +22,9 @@ public async Task FetchAsync(string id) string title = data.GetProperty("title").ToString(); string desc = data.GetProperty("desc").ToString(); string pic = data.GetProperty("pic").ToString(); + var owner = data.GetProperty("owner"); + string ownerMid = owner.GetProperty("mid").ToString(); + string ownerName = owner.GetProperty("name").ToString(); string pubTime = data.GetProperty("pubdate").ToString(); pubTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).AddSeconds(Convert.ToDouble(pubTime)).ToLocalTime().ToString(); bool bangumi = false; @@ -36,7 +39,12 @@ public async Task FetchAsync(string id) "", //epid page.GetProperty("part").ToString().Trim(), page.GetProperty("duration").GetInt32(), - page.GetProperty("dimension").GetProperty("width").ToString() + "x" + page.GetProperty("dimension").GetProperty("height").ToString()); + page.GetProperty("dimension").GetProperty("width").ToString() + "x" + page.GetProperty("dimension").GetProperty("height").ToString(), + "", + "", + ownerName, + ownerMid + ); pagesInfo.Add(p); } diff --git a/BBDown.Core/Fetcher/SeriesListFetcher.cs b/BBDown.Core/Fetcher/SeriesListFetcher.cs index 59a1e7e58..c3e97abfc 100644 --- a/BBDown.Core/Fetcher/SeriesListFetcher.cs +++ b/BBDown.Core/Fetcher/SeriesListFetcher.cs @@ -46,6 +46,8 @@ public async Task FetchAsync(string id) { var pageCount = m.GetProperty("page").GetInt32(); var desc = m.GetProperty("intro").GetString(); + var ownerName = m.GetProperty("upper").GetProperty("name").ToString(); + var ownerMid = m.GetProperty("upper").GetProperty("mid").ToString(); foreach (var page in m.GetProperty("pages").EnumerateArray()) { Page p = new Page(index++, @@ -56,7 +58,9 @@ public async Task FetchAsync(string id) page.GetProperty("duration").GetInt32(), page.GetProperty("dimension").GetProperty("width").ToString() + "x" + page.GetProperty("dimension").GetProperty("height").ToString(), m.GetProperty("cover").ToString(), - desc); + desc, + ownerName, + ownerMid); if (!pagesInfo.Contains(p)) pagesInfo.Add(p); else index--; } diff --git a/BBDown/Program.cs b/BBDown/Program.cs index 47a7df521..4e541adbc 100644 --- a/BBDown/Program.cs +++ b/BBDown/Program.cs @@ -219,7 +219,9 @@ public static async Task Main(params string[] args) $": 视频编码\r\n" + $": 视频码率\r\n" + $": 音频编码\r\n" + - $": 音频码率\r\n\r\n" + + $": 音频码率\r\n" + + $": 上传者名称\r\n" + + $": 上传者mid\r\n\r\n" + $"默认为: {SinglePageDefaultSavePath}\r\n"), new Option( new string[]{ "--multi-file-pattern", "-M"}, @@ -1209,6 +1211,8 @@ private static string FormatSavePath(string savePathFormat, string title, Video "pageTitle" => GetValidFileName(p.title, filterSlash: true), "aid" => p.aid, "cid" => p.cid, + "ownerName" => p.ownerName == null ? "" : GetValidFileName(p.ownerName, filterSlash: true), + "ownerMid" => p.ownerMid == null ? "" : p.ownerMid, "dfn" => videoTrack == null ? "" : videoTrack.dfn, "res" => videoTrack == null ? "" : videoTrack.res, "fps" => videoTrack == null ? "" : videoTrack.fps, diff --git a/README.md b/README.md index 438cbaded..ac0ada9f6 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,8 @@ Options: : 视频码率 : 音频编码 : 音频码率 + : 上传者名称 + : 上传者mid 默认为: @@ -174,6 +176,8 @@ Commands: ``|视频码率 ``|音频编码 ``|音频码率 +``|上传者名称(下载番剧时,该值为"") +``|上传者mid(下载番剧时,该值为"")