diff options
author | James Taylor <user234683@users.noreply.github.com> | 2018-07-20 00:44:18 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2018-07-20 00:44:18 -0700 |
commit | f12157cd0203d61bd5ee4f6142562da17f3109a7 (patch) | |
tree | 95cc2cd2dd5582ace68538fbed71200e9d08c618 /youtube_dl/extractor | |
parent | 80fb2decf50f353a1988feeafcde7d47894ddbfb (diff) | |
download | yt-local-f12157cd0203d61bd5ee4f6142562da17f3109a7.tar.lz yt-local-f12157cd0203d61bd5ee4f6142562da17f3109a7.tar.xz yt-local-f12157cd0203d61bd5ee4f6142562da17f3109a7.zip |
specify youtube error instead of just 500
Diffstat (limited to 'youtube_dl/extractor')
-rw-r--r-- | youtube_dl/extractor/youtube.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py index ece476d..c120cfb 100644 --- a/youtube_dl/extractor/youtube.py +++ b/youtube_dl/extractor/youtube.py @@ -49,7 +49,8 @@ from ..utils import ( uppercase_escape, urlencode_postdata, ) - +class YoutubeError(Exception): + pass class YoutubeBaseInfoExtractor(InfoExtractor): """Provide base functions for Youtube extractors""" @@ -1554,6 +1555,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor): r'"sts"\s*:\s*(\d+)', embed_webpage, 'sts', default=''), }) video_info_url = proto + '://www.youtube.com/get_video_info?' + data + video_info_webpage = self._download_webpage( video_info_url, video_id, note='Refetching age-gated info webpage', @@ -1646,7 +1648,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor): unavailable_message = extract_unavailable_message() if unavailable_message: reason = unavailable_message - raise ExtractorError( + raise YoutubeError( 'YouTube said: %s' % reason, expected=True, video_id=video_id) else: @@ -1895,7 +1897,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor): if not error_message: error_message = extract_unavailable_message() if error_message: - raise ExtractorError(error_message, expected=True) + raise YoutubeError(error_message) raise ExtractorError('no conn, hlsvp or url_encoded_fmt_stream_map information found in video info') # uploader |