mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-12 14:26:49 +01:00
[teachertube] Capture and output error message
This commit is contained in:
parent
837b061710
commit
9d6458a206
@ -5,8 +5,9 @@
|
|||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
qualities,
|
|
||||||
determine_ext,
|
determine_ext,
|
||||||
|
ExtractorError,
|
||||||
|
qualities,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -47,6 +48,12 @@ def _real_extract(self, url):
|
|||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
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 = self._html_search_meta('title', webpage, 'title', fatal=True)
|
||||||
TITLE_SUFFIX = ' - TeacherTube'
|
TITLE_SUFFIX = ' - TeacherTube'
|
||||||
if title.endswith(TITLE_SUFFIX):
|
if title.endswith(TITLE_SUFFIX):
|
||||||
|
Loading…
Reference in New Issue
Block a user