From f7face20fa0e8b566c70141b123b62777b9a98cf Mon Sep 17 00:00:00 2001 From: wyzypa Date: Fri, 10 May 2024 10:29:44 +0800 Subject: [PATCH] fix: [extractors.bilibili] add headers when requesting for danmaku --- src/you_get/extractors/bilibili.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/you_get/extractors/bilibili.py b/src/you_get/extractors/bilibili.py index b4e241c567..9860d5d6ec 100644 --- a/src/you_get/extractors/bilibili.py +++ b/src/you_get/extractors/bilibili.py @@ -335,7 +335,7 @@ def prepare(self, **kwargs): 'src': [[baseurl]], 'size': size} # get danmaku - self.danmaku = get_content('http://comment.bilibili.com/%s.xml' % cid) + self.danmaku = get_content('http://comment.bilibili.com/%s.xml' % cid, headers=self.bilibili_headers(referer=self.url)) # bangumi elif sort == 'bangumi': @@ -414,7 +414,7 @@ def prepare(self, **kwargs): 'src': [[baseurl], [audio_baseurl]], 'size': size} # get danmaku - self.danmaku = get_content('http://comment.bilibili.com/%s.xml' % cid) + self.danmaku = get_content('http://comment.bilibili.com/%s.xml' % cid, headers=self.bilibili_headers(referer=self.url)) # vc video elif sort == 'vc': @@ -596,7 +596,7 @@ def prepare_by_cid(self,avid,cid,title,html_content,playinfo,playinfo_,url): 'src': [[baseurl]], 'size': size} # get danmaku - self.danmaku = get_content('http://comment.bilibili.com/%s.xml' % cid) + self.danmaku = get_content('http://comment.bilibili.com/%s.xml' % cid, headers=self.bilibili_headers(referer=self.url)) def extract(self, **kwargs): # set UA and referer for downloading