0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-03 23:25:06 +00:00

[brightcove:new] Improve error reporting

This commit is contained in:
Sergey M․ 2016-05-21 00:59:06 +06:00
parent 1846e9ade0
commit b219f5e51b
No known key found for this signature in database
GPG key ID: 2C393E0F18A9236D

View file

@ -444,6 +444,10 @@ class BrightcoveNewIE(InfoExtractor):
# non numeric ref: prefixed video id # non numeric ref: prefixed video id
'url': 'http://players.brightcove.net/710858724001/default_default/index.html?videoId=ref:event-stream-356', 'url': 'http://players.brightcove.net/710858724001/default_default/index.html?videoId=ref:event-stream-356',
'only_matching': True, 'only_matching': True,
}, {
# unavailable video without message but with error_code
'url': 'http://players.brightcove.net/1305187701/c832abfb-641b-44eb-9da0-2fe76786505f_default/index.html?videoId=4377407326001',
'only_matching': True,
}] }]
@staticmethod @staticmethod
@ -514,8 +518,9 @@ def _real_extract(self, url):
}) })
except ExtractorError as e: except ExtractorError as e:
if isinstance(e.cause, compat_HTTPError) and e.cause.code == 403: if isinstance(e.cause, compat_HTTPError) and e.cause.code == 403:
json_data = self._parse_json(e.cause.read().decode(), video_id) json_data = self._parse_json(e.cause.read().decode(), video_id)[0]
raise ExtractorError(json_data[0]['message'], expected=True) raise ExtractorError(
json_data.get('message') or json_data['error_code'], expected=True)
raise raise
title = json_data['name'].strip() title = json_data['name'].strip()