diff --git a/biliarchiver/cli_tools/get_command.py b/biliarchiver/cli_tools/get_command.py index 443e476..63d697d 100644 --- a/biliarchiver/cli_tools/get_command.py +++ b/biliarchiver/cli_tools/get_command.py @@ -156,6 +156,8 @@ async def by_up_videos(url_or_mid: str, truncate: int = int(1e10)) -> Path: ) ) print(_("(如果最新的视频为合作视频的非主作者,UP 名可能会识别错误,但不影响获取 bvid 列表)")) + + ensure_total_size = True while pn < total_size / ps: pn += 1 print(ngettext("获取第 {} 页", "获取第 {} 页", pn).format(pn)) @@ -165,11 +167,16 @@ async def by_up_videos(url_or_mid: str, truncate: int = int(1e10)) -> Path: if len(bv_ids) >= truncate: print("truncate at", truncate) + ensure_total_size = False break print(mid, up_name, total_size) await client.aclose() + assert len(bv_ids) == len(set(bv_ids)), _("有重复的 bv_id") + if ensure_total_size: + assert total_size == len(bv_ids), _("视频总数不匹配") + filepath = f"bvids/by-up_videos/mid-{mid}-{int(time.time())}.txt" os.makedirs(os.path.dirname(filepath), exist_ok=True) abs_filepath = os.path.abspath(filepath)