mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-16 01:25:06 +00:00
[brightcove] raise ExtractorError on 403 errors and fix regex to work with tenplay
This commit is contained in:
parent
744daf9418
commit
d13bdc3824
1 changed files with 9 additions and 2 deletions
|
@ -13,6 +13,7 @@
|
||||||
compat_urllib_parse_urlparse,
|
compat_urllib_parse_urlparse,
|
||||||
compat_urlparse,
|
compat_urlparse,
|
||||||
compat_xml_parse_error,
|
compat_xml_parse_error,
|
||||||
|
compat_HTTPError,
|
||||||
)
|
)
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
determine_ext,
|
determine_ext,
|
||||||
|
@ -424,7 +425,7 @@ def _extract_urls(webpage):
|
||||||
</video>.*?
|
</video>.*?
|
||||||
<script[^>]+
|
<script[^>]+
|
||||||
src=["\'](?:https?:)?//players\.brightcove\.net/
|
src=["\'](?:https?:)?//players\.brightcove\.net/
|
||||||
(\d+)/([\da-f-]+)_([^/]+)/index\.min\.js
|
(\d+)/([\da-f-]+)_([^/]+)/index(?:\.min)?\.js
|
||||||
''', webpage):
|
''', webpage):
|
||||||
entries.append(
|
entries.append(
|
||||||
'http://players.brightcove.net/%s/%s_%s/index.html?videoId=%s'
|
'http://players.brightcove.net/%s/%s_%s/index.html?videoId=%s'
|
||||||
|
@ -458,7 +459,13 @@ def _real_extract(self, url):
|
||||||
'https://edge.api.brightcove.com/playback/v1/accounts/%s/videos/%s'
|
'https://edge.api.brightcove.com/playback/v1/accounts/%s/videos/%s'
|
||||||
% (account_id, video_id),
|
% (account_id, video_id),
|
||||||
headers={'Accept': 'application/json;pk=%s' % policy_key})
|
headers={'Accept': 'application/json;pk=%s' % policy_key})
|
||||||
json_data = self._download_json(req, video_id)
|
try:
|
||||||
|
json_data = self._download_json(req, video_id)
|
||||||
|
except ExtractorError as e:
|
||||||
|
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 403:
|
||||||
|
json_data = self._parse_json(e.cause.read().decode(), video_id)
|
||||||
|
raise ExtractorError(json_data[0]['message'], expected=True)
|
||||||
|
raise
|
||||||
|
|
||||||
title = json_data['name']
|
title = json_data['name']
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue