[youtube] meaningful error for age-gated no-embed videos

This commit is contained in:
Lauren Liberda 2021-03-21 02:40:20 +01:00
parent d7455472c7
commit 1644003935

View file

@ -1876,6 +1876,10 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
r'<meta itemprop="regionsAllowed" content="((?:(?:[A-Z]{2},)*[A-Z]{2})?)">',
video_webpage, 'allowed region list').split(',')),
expected=True)
if error_desc and 'Playback on other websites has been disabled' in error_desc:
raise ExtractorError(
'Embeds disabled for this video, account (with passed credit card or photo ID check, if in EU/EEA/CH/UK) is required',
expected=True)
if error_message == 'Video unavailable' and error_desc:
raise ExtractorError(error_desc, expected=True)
raise ExtractorError(error_message, expected=True)