mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-05-01 21:16:13 +00:00
Apply suggestions from code review
Co-authored-by: bashonly <88596187+bashonly@users.noreply.github.com>
This commit is contained in:
parent
314145548a
commit
4f28e9a93b
@ -164,18 +164,17 @@ class BilibiliBaseIE(InfoExtractor):
|
|||||||
params['w_rid'] = hashlib.md5(f'{query}{self._get_wbi_key(video_id)}'.encode()).hexdigest()
|
params['w_rid'] = hashlib.md5(f'{query}{self._get_wbi_key(video_id)}'.encode()).hexdigest()
|
||||||
return params
|
return params
|
||||||
|
|
||||||
def _download_playinfo(self, bvid, cid, headers=None, fatal=True, qn=None):
|
def _download_playinfo(self, bvid, cid, headers=None, qn=None, fatal=True):
|
||||||
params = {'bvid': bvid, 'cid': cid, 'fnval': 4048}
|
params = {'bvid': bvid, 'cid': cid, 'fnval': 4048}
|
||||||
if qn:
|
if qn:
|
||||||
params['qn'] = qn
|
params['qn'] = qn
|
||||||
play_info_obj = self._download_json(
|
play_info = self._download_json(
|
||||||
'https://api.bilibili.com/x/player/wbi/playurl', bvid,
|
'https://api.bilibili.com/x/player/wbi/playurl', bvid,
|
||||||
query=self._sign_wbi(params, bvid), headers=headers, fatal=fatal,
|
query=self._sign_wbi(params, bvid), headers=headers, fatal=fatal,
|
||||||
note=f'Downloading video formats for cid {cid} {qn or ""}')
|
note=f'Downloading video formats for cid {cid} {qn or ""}')
|
||||||
if fatal:
|
if fatal:
|
||||||
return play_info_obj['data']
|
return play_info['data']
|
||||||
else:
|
return traverse_obj(play_info, ('data', {dict})) or {}
|
||||||
return play_info_obj.get('data')
|
|
||||||
|
|
||||||
def json2srt(self, json_data):
|
def json2srt(self, json_data):
|
||||||
srt_data = ''
|
srt_data = ''
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user