fix: [extractors.bilibili] add headers when requesting for danmaku

This commit is contained in:
wyzypa 2024-05-10 10:29:44 +08:00
parent 01fa32419e
commit f7face20fa

View File

@ -335,7 +335,7 @@ class Bilibili(VideoExtractor):
'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 @@ class Bilibili(VideoExtractor):
'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 @@ class Bilibili(VideoExtractor):
'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