about summary refs log tree commit diff
path: root/youtube_dl/extractor/teachertube.py
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2018-01-24 22:46:04 +0700
committerSergey M․ <dstftw@gmail.com>2018-01-24 22:46:04 +0700
commit9d6458a206b44db72fa810af80fb742fb647ff16 (patch)
treedf8b0a05dffff403b29221829c62294510986a69 /youtube_dl/extractor/teachertube.py
parent837b0617100f20b40a4b831439263c131a59aadb (diff)
downloadyoutube-dl-9d6458a206b44db72fa810af80fb742fb647ff16.tar.gz
youtube-dl-9d6458a206b44db72fa810af80fb742fb647ff16.tar.xz
youtube-dl-9d6458a206b44db72fa810af80fb742fb647ff16.zip
[teachertube] Capture and output error message
Diffstat (limited to 'youtube_dl/extractor/teachertube.py')
-rw-r--r--youtube_dl/extractor/teachertube.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/youtube_dl/extractor/teachertube.py b/youtube_dl/extractor/teachertube.py
index 0f3231a91..1272078c5 100644
--- a/youtube_dl/extractor/teachertube.py
+++ b/youtube_dl/extractor/teachertube.py
@@ -5,8 +5,9 @@ import re
 
 from .common import InfoExtractor
 from ..utils import (
-    qualities,
     determine_ext,
+    ExtractorError,
+    qualities,
 )
 
 
@@ -47,6 +48,12 @@ class TeacherTubeIE(InfoExtractor):
         video_id = self._match_id(url)
         webpage = self._download_webpage(url, video_id)
 
+        error = self._search_regex(
+            r'<div\b[^>]+\bclass=["\']msgBox error[^>]+>([^<]+)', webpage,
+            'error', default=None)
+        if error:
+            raise ExtractorError('%s said: %s' % (self.IE_NAME, error), expected=True)
+
         title = self._html_search_meta('title', webpage, 'title', fatal=True)
         TITLE_SUFFIX = ' - TeacherTube'
         if title.endswith(TITLE_SUFFIX):