mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-22 10:11:52 +00:00
[youtube] Make get_video_info processing more robust (closes #29333)
This commit is contained in:
parent
03ab02730f
commit
47f2f2fbe9
1 changed files with 19 additions and 16 deletions
|
@ -1504,8 +1504,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
|
|
||||||
playability_status = player_response.get('playabilityStatus') or {}
|
playability_status = player_response.get('playabilityStatus') or {}
|
||||||
if playability_status.get('reason') == 'Sign in to confirm your age':
|
if playability_status.get('reason') == 'Sign in to confirm your age':
|
||||||
pr = self._parse_json(try_get(compat_parse_qs(
|
video_info = self._download_webpage(
|
||||||
self._download_webpage(
|
|
||||||
base_url + 'get_video_info', video_id,
|
base_url + 'get_video_info', video_id,
|
||||||
'Refetching age-gated info webpage',
|
'Refetching age-gated info webpage',
|
||||||
'unable to download video info webpage', query={
|
'unable to download video info webpage', query={
|
||||||
|
@ -1515,10 +1514,14 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
# See https://github.com/ytdl-org/youtube-dl/issues/29333#issuecomment-864049544
|
# See https://github.com/ytdl-org/youtube-dl/issues/29333#issuecomment-864049544
|
||||||
'c': 'TVHTML5',
|
'c': 'TVHTML5',
|
||||||
'cver': '6.20180913',
|
'cver': '6.20180913',
|
||||||
}, fatal=False)),
|
}, fatal=False)
|
||||||
lambda x: x['player_response'][0],
|
if video_info:
|
||||||
compat_str) or '{}', video_id)
|
pr = self._parse_json(
|
||||||
if pr:
|
try_get(
|
||||||
|
compat_parse_qs(video_info),
|
||||||
|
lambda x: x['player_response'][0], compat_str) or '{}',
|
||||||
|
video_id, fatal=False)
|
||||||
|
if pr and isinstance(pr, dict):
|
||||||
player_response = pr
|
player_response = pr
|
||||||
|
|
||||||
trailer_video_id = try_get(
|
trailer_video_id = try_get(
|
||||||
|
|
Loading…
Reference in a new issue