mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-21 20:46:36 -05:00
[viidea] Capture and output lecture error message (#14099)
This commit is contained in:
parent
a3431e1224
commit
64f0e30b93
1 changed files with 14 additions and 5 deletions
|
@ -4,12 +4,14 @@
|
||||||
|
|
||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..compat import (
|
from ..compat import (
|
||||||
compat_urlparse,
|
compat_HTTPError,
|
||||||
compat_str,
|
compat_str,
|
||||||
|
compat_urlparse,
|
||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
parse_duration,
|
ExtractorError,
|
||||||
js_to_json,
|
js_to_json,
|
||||||
|
parse_duration,
|
||||||
parse_iso8601,
|
parse_iso8601,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -128,9 +130,16 @@ def _real_extract(self, url):
|
||||||
|
|
||||||
base_url = self._proto_relative_url(cfg['livepipe'], 'http:')
|
base_url = self._proto_relative_url(cfg['livepipe'], 'http:')
|
||||||
|
|
||||||
lecture_data = self._download_json(
|
try:
|
||||||
'%s/site/api/lecture/%s?format=json' % (base_url, lecture_id),
|
lecture_data = self._download_json(
|
||||||
lecture_id)['lecture'][0]
|
'%s/site/api/lecture/%s?format=json' % (base_url, lecture_id),
|
||||||
|
lecture_id)['lecture'][0]
|
||||||
|
except ExtractorError as e:
|
||||||
|
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 403:
|
||||||
|
msg = self._parse_json(
|
||||||
|
e.cause.read().decode('utf-8'), lecture_id)
|
||||||
|
raise ExtractorError(msg['detail'], expected=True)
|
||||||
|
raise
|
||||||
|
|
||||||
lecture_info = {
|
lecture_info = {
|
||||||
'id': lecture_id,
|
'id': lecture_id,
|
||||||
|
|
Loading…
Reference in a new issue