diff options
author | Remita Amine <remitamine@gmail.com> | 2018-10-17 06:22:07 +0100 |
---|---|---|
committer | Remita Amine <remitamine@gmail.com> | 2018-10-17 06:22:56 +0100 |
commit | b99b0bcfa079a15a988cf931a3ce44bb480dfbdb (patch) | |
tree | f6c6329593ee44150ce0f94dc6b2f44c484dd1c9 /youtube_dl | |
parent | baeabf77428ad1a6bd5a910e7be07100fcb1eadd (diff) |
[cwtv] handle api errors(closes #17905)
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/cwtv.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/youtube_dl/extractor/cwtv.py b/youtube_dl/extractor/cwtv.py index 224a1fb5d..f9bd535f6 100644 --- a/youtube_dl/extractor/cwtv.py +++ b/youtube_dl/extractor/cwtv.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( + ExtractorError, int_or_none, parse_age_limit, parse_iso8601, @@ -66,9 +67,12 @@ class CWTVIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - video_data = self._download_json( + data = self._download_json( 'http://images.cwtv.com/feed/mobileapp/video-meta/apiversion_8/guid_' + video_id, - video_id)['video'] + video_id) + if data.get('result') != 'ok': + raise ExtractorError(data['msg'], expected=True) + video_data = data['video'] title = video_data['title'] mpx_url = video_data.get('mpx_url') or 'http://link.theplatform.com/s/cwtv/media/guid/2703454149/%s?formats=M3U' % video_id |