From c2d932b75a3b553514a6e2fd99553076d3e75084 Mon Sep 17 00:00:00 2001 From: Sheyiyuan <2125107118@qq.com> Date: Mon, 24 Mar 2025 09:28:43 +0800 Subject: [PATCH] add:comments --- main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 4bf76ad..e06606d 100644 --- a/main.py +++ b/main.py @@ -50,8 +50,10 @@ class BiliWebCrawler: self.bvid = self._extract_bvid() self.user_agent = UserAgent() self.headers = { - 'User-Agent': self.user_agent.random, - 'Referer': 'https://www.bilibili.com/', + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36', + 'Referer': f'https://www.bilibili.com/video/{self.bvid}', + 'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8', + 'Accept-Encoding': 'gzip, deflate, br' } if cookie: self.headers['Cookie'] = cookie