2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..compat
import compat_str
19 class Zee5IE(InfoExtractor
):
23 (?:https?://)(?:www\.)?zee5\.com/(?:[^#?]+/)?
25 (?:tvshows|kids|zee5originals)(?:/[^#/?]+){3}
27 )/(?P<display_id>[^#/?]+)/
29 (?P<id>[^#/?]+)/?(?:$|[?#])
32 'url': 'https://www.zee5.com/movies/details/krishna-the-birth/0-0-63098',
36 'display_id': 'krishna-the-birth',
37 'title': 'Krishna - The Birth',
41 'alt_title': 'Krishna - The Birth',
42 'uploader': 'Zee Entertainment Enterprises Ltd',
43 'release_date': '20060101',
44 'upload_date': '20060101',
45 'timestamp': 1136073600,
46 'thumbnail': 'https://akamaividz.zee5.com/resources/0-0-63098/list/270x152/0063098_list_80888170.jpg',
53 'url': 'https://zee5.com/tvshows/details/krishna-balram/0-6-1871/episode-1-the-test-of-bramha/0-1-233402',
57 'display_id': 'episode-1-the-test-of-bramha',
58 'title': 'Episode 1 - The Test Of Bramha',
62 'alt_title': 'Episode 1 - The Test Of Bramha',
63 'uploader': 'Green Gold',
64 'release_date': '20090101',
65 'upload_date': '20090101',
66 'timestamp': 1230768000,
67 'thumbnail': 'https://akamaividz.zee5.com/resources/0-1-233402/list/270x152/01233402_list.jpg',
68 'series': 'Krishna Balram',
77 'url': 'https://www.zee5.com/hi/tvshows/details/kundali-bhagya/0-6-366/kundali-bhagya-march-08-2021/0-1-manual_7g9jv1os7730?country=IN',
80 'url': 'https://www.zee5.com/global/hi/tvshows/details/kundali-bhagya/0-6-366/kundali-bhagya-march-08-2021/0-1-manual_7g9jv1os7730',
84 def _real_extract(self
, url
):
85 video_id
, display_id
= re
.match(self
._VALID
_URL
, url
).group('id', 'display_id')
86 access_token_request
= self
._download
_json
(
87 'https://useraction.zee5.com/token/platform_tokens.php?platform_name=web_app',
88 video_id
, note
='Downloading access token')
89 token_request
= self
._download
_json
(
90 'https://useraction.zee5.com/tokennd',
91 video_id
, note
='Downloading video token')
92 json_data
= self
._download
_json
(
93 'https://gwapi.zee5.com/content/details/{}?translation=en&country=IN'.format(video_id
),
94 video_id
, headers
={'X-Access-Token': access_token_request['token']}
)
97 (lambda x
: x
['hls'][0], lambda x
: x
['video_details']['hls_url']),
99 formats
= self
._extract
_m
3u8_formats
(
100 'https://zee5vodnd.akamaized.net' + m3u8_url
.replace('/drm', '/hls', 1) + token_request
['video_token'],
101 video_id
, fatal
=False)
104 (lambda x
: x
['video'][0], lambda x
: x
['video_details']['url']),
106 formats
+= self
._extract
_mpd
_formats
(
107 'https://zee5vod.akamaized.net' + mpd_url
,
108 video_id
, fatal
=False)
110 self
._sort
_formats
(formats
)
113 'display_id': display_id
,
114 'title': json_data
['title'],
116 'duration': int_or_none(json_data
.get('duration')),
117 'average_rating': int_or_none(json_data
.get('rating')),
118 'description': str_or_none(json_data
.get('description')),
119 'alt_title': str_or_none(json_data
.get('original_title')),
120 'uploader': str_or_none(json_data
.get('content_owner')),
121 'age_limit': parse_age_limit(json_data
.get('age_rating')),
122 'release_date': unified_strdate(json_data
.get('release_date')),
123 'timestamp': unified_timestamp(json_data
.get('release_date')),
124 'thumbnail': url_or_none(json_data
.get('image_url')),
125 'series': try_get(json_data
, lambda x
: x
['tvshow_details']['title'], str),
126 'season': try_get(json_data
, lambda x
: x
['season_details']['title'], str),
127 'season_number': int_or_none(try_get(json_data
, lambda x
: x
['season_details']['index'])),
128 'episode_number': int_or_none(try_get(json_data
, lambda x
: x
['index'])),
129 'tags': try_get(json_data
, lambda x
: x
['tags'], list)
133 class Zee5SeriesIE(InfoExtractor
):
134 IE_NAME
= 'zee5:series'
135 _VALID_URL
= r
'''(?x)
138 (?:https?://)(?:www\.)?zee5\.com/(?:[^#?]+/)?
139 (?:tvshows|kids|zee5originals)(?:/[^#/?]+){2}/
141 (?P<id>[^#/?]+)/?(?:$|[?#])
144 'url': 'https://www.zee5.com/kids/kids-shows/krishna-balram/0-6-1871',
145 'playlist_mincount': 43,
150 'url': 'https://www.zee5.com/tvshows/details/bhabi-ji-ghar-par-hai/0-6-199',
151 'playlist_mincount': 1500,
156 'url': 'https://www.zee5.com/tvshows/details/agent-raghav-crime-branch/0-6-965',
157 'playlist_mincount': 25,
162 'url': 'https://www.zee5.com/ta/tvshows/details/nagabhairavi/0-6-3201',
163 'playlist_mincount': 3,
168 'url': 'https://www.zee5.com/global/hi/tvshows/details/khwaabon-ki-zamin-par/0-6-270',
169 'playlist_mincount': 150,
176 def _entries(self
, show_id
):
177 access_token_request
= self
._download
_json
(
178 'https://useraction.zee5.com/token/platform_tokens.php?platform_name=web_app',
179 show_id
, note
='Downloading access token')
181 'X-Access-Token': access_token_request
['token'],
182 'Referer': 'https://www.zee5.com/',
184 show_url
= 'https://gwapi.zee5.com/content/tvshow/{}?translation=en&country=IN'.format(show_id
)
187 show_json
= self
._download
_json
(show_url
, video_id
=show_id
, headers
=headers
)
188 for season
in show_json
.get('seasons') or []:
189 season_id
= try_get(season
, lambda x
: x
['id'], compat_str
)
190 next_url
= 'https://gwapi.zee5.com/content/tvshow/?season_id={}&type=episode&translation=en&country=IN&on_air=false&asset_subtype=tvshow&page=1&limit=100'.format(season_id
)
193 episodes_json
= self
._download
_json
(
194 next_url
, video_id
=show_id
, headers
=headers
,
195 note
='Downloading JSON metadata page %d' % page_num
)
196 for episode
in try_get(episodes_json
, lambda x
: x
['episode'], list) or []:
197 video_id
= episode
.get('id')
198 yield self
.url_result(
199 'zee5:%s' % video_id
,
200 ie
=Zee5IE
.ie_key(), video_id
=video_id
)
201 next_url
= url_or_none(episodes_json
.get('next_episode_api'))
203 def _real_extract(self
, url
):
204 show_id
= self
._match
_id
(url
)
205 return self
.playlist_result(self
._entries
(show_id
), playlist_id
=show_id
)