|
|
|
@ -93,11 +93,11 @@ class BilibiliBaseIE(InfoExtractor):
|
|
|
|
|
|
|
|
|
|
return formats
|
|
|
|
|
|
|
|
|
|
def _download_playinfo(self, video_id, cid):
|
|
|
|
|
def _download_playinfo(self, video_id, cid, headers=None):
|
|
|
|
|
return self._download_json(
|
|
|
|
|
'https://api.bilibili.com/x/player/playurl', video_id,
|
|
|
|
|
query={'bvid': video_id, 'cid': cid, 'fnval': 4048},
|
|
|
|
|
note=f'Downloading video formats for cid {cid}')['data']
|
|
|
|
|
note=f'Downloading video formats for cid {cid}', headers=headers)['data']
|
|
|
|
|
|
|
|
|
|
def json2srt(self, json_data):
|
|
|
|
|
srt_data = ''
|
|
|
|
@ -532,7 +532,7 @@ class BiliBiliIE(BilibiliBaseIE):
|
|
|
|
|
self._download_json(
|
|
|
|
|
'https://api.bilibili.com/x/player/pagelist', video_id,
|
|
|
|
|
fatal=False, query={'bvid': video_id, 'jsonp': 'jsonp'},
|
|
|
|
|
note='Extracting videos in anthology'),
|
|
|
|
|
note='Extracting videos in anthology', headers=headers),
|
|
|
|
|
'data', expected_type=list) or []
|
|
|
|
|
is_anthology = len(page_list_json) > 1
|
|
|
|
|
|
|
|
|
@ -553,7 +553,7 @@ class BiliBiliIE(BilibiliBaseIE):
|
|
|
|
|
|
|
|
|
|
festival_info = {}
|
|
|
|
|
if is_festival:
|
|
|
|
|
play_info = self._download_playinfo(video_id, cid)
|
|
|
|
|
play_info = self._download_playinfo(video_id, cid, headers=headers)
|
|
|
|
|
|
|
|
|
|
festival_info = traverse_obj(initial_state, {
|
|
|
|
|
'uploader': ('videoInfo', 'upName'),
|
|
|
|
@ -667,7 +667,7 @@ class BiliBiliBangumiIE(BilibiliBaseIE):
|
|
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
|
|
|
|
episode_id = self._match_id(url)
|
|
|
|
|
headers = {'Referer': url, **self.geo_verification_headers()}
|
|
|
|
|
headers = self.geo_verification_headers()
|
|
|
|
|
webpage = self._download_webpage(url, episode_id, headers=headers)
|
|
|
|
|
|
|
|
|
|
if '您所在的地区无法观看本片' in webpage:
|
|
|
|
@ -675,6 +675,7 @@ class BiliBiliBangumiIE(BilibiliBaseIE):
|
|
|
|
|
elif '正在观看预览,大会员免费看全片' in webpage:
|
|
|
|
|
self.raise_login_required('This video is for premium members only')
|
|
|
|
|
|
|
|
|
|
headers['Referer'] = url
|
|
|
|
|
play_info = self._download_json(
|
|
|
|
|
'https://api.bilibili.com/pgc/player/web/v2/playurl', episode_id,
|
|
|
|
|
'Extracting episode', query={'fnval': '4048', 'ep_id': episode_id},
|
|
|
|
|