Fix 404 errors on scheduled live events and age-gate bypass

get_video_info now returns 404 error. Adding html5=1 fixes it
(for now). See
https://github.com/ytdl-org/youtube-dl/issues/29086#issuecomment-844892791

Also handles 404 error if it arises so it will be non-fatal

Signed-off-by: Jesús <heckyel@hyperbola.info>
This commit is contained in:
James Taylor 2021-05-26 21:35:48 -07:00 committed by Jesús
parent 1b860c6917
commit 9077596979
No known key found for this signature in database
GPG Key ID: F6EE7BC59A315766

View File

@ -217,6 +217,13 @@ def decrypt_signatures(info, video_id):
return err return err
def _add_to_error(info, key, additional_message):
if key in info and info[key]:
info[key] += additional_message
else:
info[key] = additional_message
def extract_info(video_id, use_invidious, playlist_id=None, index=None): def extract_info(video_id, use_invidious, playlist_id=None, index=None):
# bpctr=9999999999 will bypass are-you-sure dialogs for controversial # bpctr=9999999999 will bypass are-you-sure dialogs for controversial
# videos # videos
@ -241,11 +248,21 @@ def extract_info(video_id, use_invidious, playlist_id=None, index=None):
'video_id': video_id, 'video_id': video_id,
'eurl': 'https://youtube.googleapis.com/v/' + video_id, 'eurl': 'https://youtube.googleapis.com/v/' + video_id,
} }
url = 'https://www.youtube.com/get_video_info?' + urllib.parse.urlencode(data) url = 'https://www.youtube.com/get_video_info?html5=1&'
video_info_page = util.fetch_url( url += urllib.parse.urlencode(data)
url, headers=watch_headers, debug_name='get_video_info', try:
report_text='Fetched get_video_info page').decode('utf-8') video_info_page = util.fetch_url(
yt_data_extract.update_with_age_restricted_info(info, video_info_page) url, headers=watch_headers, debug_name='get_video_info',
report_text='Fetched get_video_info page').decode('utf-8')
except util.FetchError as e:
if e.code == '404':
_add_to_error(info, 'playability_error',
'\n\nget_video_info not available (404).')
else:
raise
else:
yt_data_extract.update_with_age_restricted_info(info,
video_info_page)
# signature decryption # signature decryption
decryption_error = decrypt_signatures(info, video_id) decryption_error = decrypt_signatures(info, video_id)