2 from __future__ import unicode_literals
4 from .common import InfoExtractor
7 class VootIE(InfoExtractor):
8 _VALID_URL = r'https?://(?:www\.)?voot\.com/shows/(?:.+?[/-]?)/1/(?:.+?[0-9]?)/(?:.+?[/-]?)/(?P<id>[0-9]+)'
10 'url': 'https://www.voot.com/shows/ishq-ka-rang-safed/1/360558/is-this-the-end-of-kamini-/441353',
14 'title': 'Ishq Ka Rang Safed - Season 01 - Episode 340',
15 'thumbnail': r're:^https?://.*\.jpg$',
19 _GET_CONTENT_TEMPLATE = 'https://wapi.voot.com/ws/ott/getMediaInfo.json?platform=Web&pId=3&mediaId=%s'
21 def _download_json(self, url_or_request, video_id, note='Downloading JSON metadata', fatal=True):
22 json_data = super(VootIE, self)._download_json(url_or_request, video_id, note, fatal=fatal)
23 if json_data['status']['code'] != 0:
25 raise ExtractorError(json_data['status']['message'])
27 return json_data['assets']
29 def _real_extract(self, url):
30 video_id = self._match_id(url)
31 video_data = self._download_json(
32 self._GET_CONTENT_TEMPLATE % video_id,
39 format_url = video_data.get('URL')
40 formats.extend(self._extract_m3u8_formats(format_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
42 if video_data['Pictures']:
43 for picture in video_data['Pictures']:
44 #Get only first available thumbnail
45 thumbnail = picture.get('URL')
48 self._sort_formats(formats)
52 'title': video_data.get('MediaName'),
53 'thumbnail': thumbnail,