Skip to content

Commit

Permalink
[cwtv] handle api errors(closes #17905)
Browse files Browse the repository at this point in the history
  • Loading branch information
remitamine committed Oct 17, 2018
1 parent baeabf7 commit b99b0bc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions youtube_dl/extractor/cwtv.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
parse_age_limit,
parse_iso8601,
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit b99b0bc

Please sign in to comment.