diff --git a/BBDown.Core/Fetcher/BangumiInfoFetcher.cs b/BBDown.Core/Fetcher/BangumiInfoFetcher.cs index 0c4b8658e..65f843140 100644 --- a/BBDown.Core/Fetcher/BangumiInfoFetcher.cs +++ b/BBDown.Core/Fetcher/BangumiInfoFetcher.cs @@ -18,7 +18,8 @@ public async Task FetchAsync(string id) string cover = result.GetProperty("cover").ToString(); string title = result.GetProperty("title").ToString(); string desc = result.GetProperty("evaluate").ToString(); - long pubTime = DateTimeOffset.ParseExact(result.GetProperty("publish").GetProperty("pub_time").ToString(), "yyyy-MM-dd HH:mm:ss", null).ToUnixTimeSeconds(); + string pubTimeStr = result.GetProperty("publish").GetProperty("pub_time").ToString(); + long pubTime = string.IsNullOrEmpty(pubTimeStr) ? 0 : DateTimeOffset.ParseExact(pubTimeStr, "yyyy-MM-dd HH:mm:ss", null).ToUnixTimeSeconds(); var pages = result.GetProperty("episodes").EnumerateArray(); List pagesInfo = new(); int i = 1; diff --git a/BBDown.Core/Fetcher/IntlBangumiInfoFetcher.cs b/BBDown.Core/Fetcher/IntlBangumiInfoFetcher.cs index f2b704d57..faec34d0a 100644 --- a/BBDown.Core/Fetcher/IntlBangumiInfoFetcher.cs +++ b/BBDown.Core/Fetcher/IntlBangumiInfoFetcher.cs @@ -39,7 +39,8 @@ public async Task FetchAsync(string id) } } - long pubTime = DateTimeOffset.ParseExact(result.GetProperty("publish").GetProperty("pub_time").ToString(), "yyyy-MM-dd HH:mm:ss", null).ToUnixTimeSeconds(); + string pubTimeStr = result.GetProperty("publish").GetProperty("pub_time").ToString(); + long pubTime = string.IsNullOrEmpty(pubTimeStr) ? 0 : DateTimeOffset.ParseExact(pubTimeStr, "yyyy-MM-dd HH:mm:ss", null).ToUnixTimeSeconds(); var pages = new List(); if (result.TryGetProperty("episodes", out JsonElement episodes)) { @@ -99,7 +100,7 @@ public async Task FetchAsync(string id) page.GetProperty("id").ToString(), _title, 0, res, - page.GetProperty("pub_time").GetInt64()); + page.TryGetProperty("pub_time", out JsonElement pub_time) ? pub_time.GetInt64() : 0); if (p.epid == id) index = p.index.ToString(); pagesInfo.Add(p); } diff --git a/BBDown/Program.cs b/BBDown/Program.cs index 61e14f580..ed331e29d 100644 --- a/BBDown/Program.cs +++ b/BBDown/Program.cs @@ -255,7 +255,10 @@ public static (Dictionary encodingPriority, Dictionary !string.IsNullOrEmpty(p.ownerMid))?.ownerMid; if (!string.IsNullOrEmpty(mid)) {