2 from __future__ import unicode_literals
4 from .common import InfoExtractor
13 class VootIE(InfoExtractor):
14 _VALID_URL = r'https?://(?:www\.)?voot\.com/(?:[^/]+/)+(?P<id>\d+)'
15 _GEO_COUNTRIES = ['IN']
17 'url': 'https://www.voot.com/shows/ishq-ka-rang-safed/1/360558/is-this-the-end-of-kamini-/441353',
21 'title': 'Ishq Ka Rang Safed - Season 01 - Episode 340',
22 'description': 'md5:06291fbbbc4dcbe21235c40c262507c1',
23 'timestamp': 1472162937,
24 'upload_date': '20160825',
26 'series': 'Ishq Ka Rang Safed',
28 'episode': 'Is this the end of Kamini?',
29 'episode_number': 340,
34 'skip_download': True,
36 'expected_warnings': ['Failed to download m3u8 information'],
38 'url': 'https://www.voot.com/kids/characters/mighty-cat-masked-niyander-e-/400478/school-bag-disappears/440925',
39 'only_matching': True,
41 'url': 'https://www.voot.com/movies/pandavas-5/424627',
42 'only_matching': True,
45 def _real_extract(self, url):
46 video_id = self._match_id(url)
48 media_info = self._download_json(
49 'https://wapi.voot.com/ws/ott/getMediaInfo.json', video_id,
56 status_code = try_get(media_info, lambda x: x['status']['code'], int)
58 raise ExtractorError(media_info['status']['message'], expected=True)
60 media = media_info['assets']
62 title = media['MediaName']
63 formats = self._extract_m3u8_formats(
64 'https://cdnapisec.kaltura.com/p/1982551/playManifest/pt/https/f/applehttp/t/web/e/' + media['EntryId'],
65 video_id, 'mp4', m3u8_id='hls', fatal=False)
67 description, series, season_number, episode, episode_number = [None] * 5
69 for meta in try_get(media, lambda x: x['Metas'], list) or []:
70 key, value = meta.get('Key'), meta.get('Value')
71 if not key or not value:
73 if key == 'ContentSynopsis':
75 elif key == 'RefSeriesTitle':
77 elif key == 'RefSeriesSeason':
78 season_number = int_or_none(value)
79 elif key == 'EpisodeMainTitle':
81 elif key == 'EpisodeNo':
82 episode_number = int_or_none(value)
87 'description': description,
89 'season_number': season_number,
91 'episode_number': episode_number,
92 'timestamp': unified_timestamp(media.get('CreationDate')),
93 'duration': int_or_none(media.get('Duration')),
94 'view_count': int_or_none(media.get('ViewCounter')),
95 'like_count': int_or_none(media.get('like_counter')),