mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-05-26 17:22:44 +00:00
[ie/bilibili] provide fallback for playinfo extraction
This commit is contained in:
parent
00dcde7286
commit
e92dcf0077
@ -644,7 +644,8 @@ class BiliBiliIE(BilibiliBaseIE):
|
|||||||
video_data = initial_state['videoInfo']
|
video_data = initial_state['videoInfo']
|
||||||
else:
|
else:
|
||||||
play_info_obj = self._search_json(
|
play_info_obj = self._search_json(
|
||||||
r'window\.__playinfo__\s*=', webpage, 'play info', video_id, fatal=False)
|
r'window\.__playinfo__\s*=', webpage, 'play info', video_id, default=None)
|
||||||
|
play_info = None
|
||||||
if not play_info_obj:
|
if not play_info_obj:
|
||||||
if traverse_obj(initial_state, ('error', 'trueCode')) == -403:
|
if traverse_obj(initial_state, ('error', 'trueCode')) == -403:
|
||||||
self.raise_login_required()
|
self.raise_login_required()
|
||||||
@ -652,6 +653,8 @@ class BiliBiliIE(BilibiliBaseIE):
|
|||||||
raise ExtractorError(
|
raise ExtractorError(
|
||||||
'This video may be deleted or geo-restricted. '
|
'This video may be deleted or geo-restricted. '
|
||||||
'You might want to try a VPN or a proxy server (with --proxy)', expected=True)
|
'You might want to try a VPN or a proxy server (with --proxy)', expected=True)
|
||||||
|
play_info = self._download_playinfo(video_id, initial_state['cid'], headers=headers)
|
||||||
|
else:
|
||||||
play_info = traverse_obj(play_info_obj, ('data', {dict}))
|
play_info = traverse_obj(play_info_obj, ('data', {dict}))
|
||||||
if not play_info:
|
if not play_info:
|
||||||
if traverse_obj(play_info_obj, 'code') == 87007:
|
if traverse_obj(play_info_obj, 'code') == 87007:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user