From 47a1cea6db3c0977e7f4e1ae5ddc40600740ac5b Mon Sep 17 00:00:00 2001 From: NaitLee Date: Mon, 12 Aug 2024 12:56:52 +0000 Subject: [PATCH] fix: request of get_danmaku_xml now needs user-agent header --- bilibili_api/video.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bilibili_api/video.py b/bilibili_api/video.py index 216a5314..e8495507 100644 --- a/bilibili_api/video.py +++ b/bilibili_api/video.py @@ -1203,6 +1203,7 @@ async def get_danmaku_xml( url = f"https://comment.bilibili.com/{cid}.xml" sess = get_session() config: dict[Any, Any] = {"url": url} + config["headers"] = {"User-Agent": "Mozilla/5.0"} # 代理 if settings.proxy: config["proxies"] = {"all://", settings.proxy}