mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-23 11:31:29 +01:00
modified: yt_dlp/extractor/bilibili.py
This commit is contained in:
parent
a3bab4752a
commit
e187799c58
|
@ -164,14 +164,12 @@ def _sign_wbi(self, params, video_id):
|
|||
params['w_rid'] = hashlib.md5(f'{query}{self._get_wbi_key(video_id)}'.encode()).hexdigest()
|
||||
return params
|
||||
|
||||
def _download_playinfo(self, bvid, cid, headers=None, qn=None):
|
||||
params = {'bvid': bvid, 'cid': cid, 'fnval': 4048}
|
||||
if qn:
|
||||
params['qn'] = qn
|
||||
def _download_playinfo(self, bvid, cid, headers=None, **kwargs):
|
||||
params = {'bvid': bvid, 'cid': cid, 'fnval': 4048, **kwargs}
|
||||
return self._download_json(
|
||||
'https://api.bilibili.com/x/player/wbi/playurl', bvid,
|
||||
query=self._sign_wbi(params, bvid), headers=headers,
|
||||
note=f'Downloading video formats for cid {cid} {qn or ""}')['data']
|
||||
note=f'Downloading video formats for cid {cid} {kwargs.get("qn", "")}')['data']
|
||||
|
||||
def json2srt(self, json_data):
|
||||
srt_data = ''
|
||||
|
@ -723,6 +721,7 @@ def _real_extract(self, url):
|
|||
duration=traverse_obj(initial_state, ('videoData', 'duration', {int_or_none})),
|
||||
__post_extractor=self.extract_comments(aid))
|
||||
else:
|
||||
play_info = self._download_playinfo(video_id, cid, headers=headers, try_look=1)
|
||||
formats = self.extract_formats(play_info)
|
||||
|
||||
if not traverse_obj(play_info, ('dash')):
|
||||
|
|
Loading…
Reference in New Issue
Block a user