]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[youtube] Capture and output unavailable message
authorSergey M․ <dstftw@gmail.com>
Tue, 19 Jan 2016 14:54:43 +0000 (20:54 +0600)
committerSergey M․ <dstftw@gmail.com>
Tue, 19 Jan 2016 14:54:43 +0000 (20:54 +0600)
youtube_dl/extractor/youtube.py

index 2045f53861d8eade9965a3f0644bb5a9af63a865..2a0c2e5a6deeee05d4355e12122542e3b839332e 100644 (file)
@@ -1508,6 +1508,11 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
             for a_format in formats:
                 a_format.setdefault('http_headers', {})['Youtubedl-no-compression'] = 'True'
         else:
+            unavailable_message = self._html_search_regex(
+                r'(?s)<h1[^>]+id="unavailable-message"[^>]*>(.+?)</h1>',
+                video_webpage, 'unavailable message', default=None)
+            if unavailable_message:
+                raise ExtractorError(unavailable_message, expected=True)
             raise ExtractorError('no conn, hlsvp or url_encoded_fmt_stream_map information found in video info')
 
         # Look for the DASH manifest