From 8c84d4fdb520f6dc6a547fdf1dad7aaa155857ba Mon Sep 17 00:00:00 2001 From: xtaodada Date: Thu, 4 Apr 2024 00:18:09 +0800 Subject: [PATCH] fix: bilibili download --- defs/bilibili_download.py | 2 ++ requirements.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/defs/bilibili_download.py b/defs/bilibili_download.py index d8eb248..34a0c52 100644 --- a/defs/bilibili_download.py +++ b/defs/bilibili_download.py @@ -147,6 +147,8 @@ async def download_url(url: str, out: str, m: Message, start: str): async with sess.stream("GET", url) as resp: logger.info(f"Downloading {start}") resp: Response + if resp.status_code != 200: + raise BilibiliDownloaderError("下载链接异常,请尝试重新下载") length = resp.headers.get("content-length") if not length: raise FileNoSize diff --git a/requirements.txt b/requirements.txt index 540139f..6a49c83 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ pyrogram==2.0.106 tgcrypto==1.2.5 -bilibili-api-python==15.5.4 +bilibili-api-python==16.2.1 httpx pillow cashews