diff options
author | Yen Chi Hsuan <yan12125@gmail.com> | 2015-06-27 13:15:57 +0800 |
---|---|---|
committer | Yen Chi Hsuan <yan12125@gmail.com> | 2015-06-27 13:15:57 +0800 |
commit | af214c3a79bb598d3a13559c5ebddcca4584669a (patch) | |
tree | f231df7e97c62d06a19e669d0d65f2bd4728d67a /youtube_dl/extractor | |
parent | 4eb10f66216b5239a9a8efcf950c9b16f5c8b5de (diff) |
[youtube] More useful messages for georestricted videos (#5716)
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/youtube.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index a3da56c14..d9240ff02 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -32,6 +32,7 @@ from ..utils import ( unescapeHTML, unified_strdate, uppercase_escape, + ISO3166Utils, ) @@ -903,6 +904,12 @@ class YoutubeIE(YoutubeBaseInfoExtractor): break if 'token' not in video_info: if 'reason' in video_info: + if 'The uploader has not made this video available in your country.' in video_info['reason']: + regions_allowed = self._html_search_meta('regionsAllowed', video_webpage, default=None) + if regions_allowed is not None: + raise ExtractorError('YouTube said: This video is available in %s only' % ( + ', '.join(map(ISO3166Utils.short2full, regions_allowed.split(',')))), + expected=True) raise ExtractorError( 'YouTube said: %s' % video_info['reason'][0], expected=True, video_id=video_id) |