]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/voot.py
1 from .common
import InfoExtractor
2 from ..compat
import compat_str
11 class VootIE(InfoExtractor
):
15 https?://(?:www\.)?voot\.com/?
18 (?:shows|kids)/(?:[^/]+/){4}
23 _GEO_COUNTRIES
= ['IN']
25 'url': 'https://www.voot.com/shows/ishq-ka-rang-safed/1/360558/is-this-the-end-of-kamini-/441353',
29 'title': 'Ishq Ka Rang Safed - Season 01 - Episode 340',
30 'description': 'md5:06291fbbbc4dcbe21235c40c262507c1',
31 'timestamp': 1472162937,
32 'upload_date': '20160825',
33 'series': 'Ishq Ka Rang Safed',
35 'episode': 'Is this the end of Kamini?',
36 'episode_number': 340,
41 'skip_download': True,
43 'expected_warnings': ['Failed to download m3u8 information'],
45 'url': 'https://www.voot.com/kids/characters/mighty-cat-masked-niyander-e-/400478/school-bag-disappears/440925',
46 'only_matching': True,
48 'url': 'https://www.voot.com/movies/pandavas-5/424627',
49 'only_matching': True,
51 'url': 'https://www.voot.com/movie/fight-club/621842',
52 'only_matching': True,
55 def _real_extract(self
, url
):
56 video_id
= self
._match
_id
(url
)
57 media_info
= self
._download
_json
(
58 'https://wapi.voot.com/ws/ott/getMediaInfo.json', video_id
,
65 status_code
= try_get(media_info
, lambda x
: x
['status']['code'], int)
67 raise ExtractorError(media_info
['status']['message'], expected
=True)
69 media
= media_info
['assets']
71 entry_id
= media
['EntryId']
72 title
= media
['MediaName']
73 formats
= self
._extract
_m
3u8_formats
(
74 'https://cdnapisec.kaltura.com/p/1982551/playManifest/pt/https/f/applehttp/t/web/e/' + entry_id
,
75 video_id
, 'mp4', m3u8_id
='hls')
77 description
, series
, season_number
, episode
, episode_number
= [None] * 5
79 for meta
in try_get(media
, lambda x
: x
['Metas'], list) or []:
80 key
, value
= meta
.get('Key'), meta
.get('Value')
81 if not key
or not value
:
83 if key
== 'ContentSynopsis':
85 elif key
== 'RefSeriesTitle':
87 elif key
== 'RefSeriesSeason':
88 season_number
= int_or_none(value
)
89 elif key
== 'EpisodeMainTitle':
91 elif key
== 'EpisodeNo':
92 episode_number
= int_or_none(value
)
94 'extractor_key': 'Kaltura',
97 'description': description
,
99 'season_number': season_number
,
101 'episode_number': episode_number
,
102 'timestamp': unified_timestamp(media
.get('CreationDate')),
103 'duration': int_or_none(media
.get('Duration')),
104 'view_count': int_or_none(media
.get('ViewCounter')),
105 'like_count': int_or_none(media
.get('like_counter')),
110 class VootSeriesIE(InfoExtractor
):
111 _VALID_URL
= r
'https?://(?:www\.)?voot\.com/shows/[^/]+/(?P<id>\d{3,})'
113 'url': 'https://www.voot.com/shows/chakravartin-ashoka-samrat/100002',
114 'playlist_mincount': 442,
119 'url': 'https://www.voot.com/shows/ishq-ka-rang-safed/100003',
120 'playlist_mincount': 341,
125 _SHOW_API
= 'https://psapi.voot.com/media/voot/v1/voot-web/content/generic/season-by-show?sort=season%3Aasc&id={}&responseType=common'
126 _SEASON_API
= 'https://psapi.voot.com/media/voot/v1/voot-web/content/generic/series-wise-episode?sort=episode%3Aasc&id={}&responseType=common&page={:d}'
128 def _entries(self
, show_id
):
129 show_json
= self
._download
_json
(self
._SHOW
_API
.format(show_id
), video_id
=show_id
)
130 for season
in show_json
.get('result', []):
132 season_id
= try_get(season
, lambda x
: x
['id'], compat_str
)
133 season_json
= self
._download
_json
(self
._SEASON
_API
.format(season_id
, page_num
),
135 note
='Downloading JSON metadata page %d' % page_num
)
136 episodes_json
= season_json
.get('result', [])
139 for episode
in episodes_json
:
140 video_id
= episode
.get('id')
141 yield self
.url_result(
142 'voot:%s' % video_id
, ie
=VootIE
.ie_key(), video_id
=video_id
)
143 episodes_json
= self
._download
_json
(self
._SEASON
_API
.format(season_id
, page_num
),
145 note
='Downloading JSON metadata page %d' % page_num
)['result']
147 def _real_extract(self
, url
):
148 show_id
= self
._match
_id
(url
)
149 return self
.playlist_result(self
._entries
(show_id
), playlist_id
=show_id
)