Skip to content

Commit f5e00ef

Browse files
committed
feat: update Chrome UA to 133, fix truncated UA, add sec-ch-ua headers
1 parent 0d7c949 commit f5e00ef

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

bili_cli/client.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,14 @@ async def _get_video_comments_direct(
303303
"User-Agent": (
304304
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
305305
"AppleWebKit/537.36 (KHTML, like Gecko) "
306-
"Chrome/120.0.0.0 Safari/537.36"
306+
"Chrome/133.0.0.0 Safari/537.36"
307307
),
308308
"Referer": f"https://www.bilibili.com/video/{bvid}/",
309309
"Accept": "application/json, text/plain, */*",
310310
"Accept-Language": "zh-CN,zh;q=0.9",
311+
"sec-ch-ua": '"Chromium";v="133", "Not(A:Brand";v="99", "Google Chrome";v="133"',
312+
"sec-ch-ua-mobile": "?0",
313+
"sec-ch-ua-platform": '"macOS"',
311314
}
312315
if credential and credential.sessdata:
313316
cookies = [f"SESSDATA={credential.sessdata}"]
@@ -570,7 +573,11 @@ async def triple_video(bvid: str, credential: Credential) -> dict[str, Any]:
570573
# ---------------------------------------------------------------------------
571574

572575
_DOWNLOAD_HEADERS = {
573-
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36",
576+
"User-Agent": (
577+
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
578+
"AppleWebKit/537.36 (KHTML, like Gecko) "
579+
"Chrome/133.0.0.0 Safari/537.36"
580+
),
574581
"Referer": "https://www.bilibili.com",
575582
}
576583

0 commit comments

Comments
 (0)