Browse Source

[teachertube] Capture and output error message

master-ytdl-org
Sergey M․ 7 years ago
parent
commit
9d6458a206
No known key found for this signature in database GPG Key ID: 2C393E0F18A9236D
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      youtube_dl/extractor/teachertube.py

+ 8
- 1
youtube_dl/extractor/teachertube.py View File

@ -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):


Loading…
Cancel
Save