projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
837b061
)
[teachertube] Capture and output error message
author
Sergey M․
<dstftw@gmail.com>
Wed, 24 Jan 2018 15:46:04 +0000
(22:46 +0700)
committer
Sergey M․
<dstftw@gmail.com>
Wed, 24 Jan 2018 15:46:04 +0000
(22:46 +0700)
youtube_dl/extractor/teachertube.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/teachertube.py
b/youtube_dl/extractor/teachertube.py
index 0f3231a9125b0f8ddef32319c2f5a5ce540df994..1272078c50b8703aa906e055fc57842078542e95 100644
(file)
--- 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 (
from .common import InfoExtractor
from ..utils import (
- qualities,
determine_ext,
determine_ext,
+ ExtractorError,
+ qualities,
)
)
@@
-47,6
+48,12
@@
class TeacherTubeIE(InfoExtractor):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
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):
title = self._html_search_meta('title', webpage, 'title', fatal=True)
TITLE_SUFFIX = ' - TeacherTube'
if title.endswith(TITLE_SUFFIX):