2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
18 class Zee5IE(InfoExtractor
):
19 _VALID_URL
= r
'(?:zee5:|https?://(?:www\.)?zee5\.com/[^#?]*/(?P<display_id>[^#?]+)/)(?P<id>[^#?/]+)(?:$|[?#])'
21 'url': 'https://www.zee5.com/movies/details/krishna-the-birth/0-0-63098',
25 "display_id": "krishna-the-birth",
26 "title": "Krishna - The Birth",
30 "alt_title": "Krishna - The Birth",
31 "uploader": "Zee Entertainment Enterprises Ltd",
32 "release_date": "20060101",
33 "upload_date": "20060101",
34 "timestamp": 1136073600,
35 "thumbnail": "https://akamaividz.zee5.com/resources/0-0-63098/list/270x152/0063098_list_80888170.jpg",
42 'url': 'https://zee5.com/tvshows/details/krishna-balram/0-6-1871/episode-1-the-test-of-bramha/0-1-233402',
46 "display_id": "episode-1-the-test-of-bramha",
47 "title": "Episode 1 - The Test Of Bramha",
51 "alt_title": "Episode 1 - The Test Of Bramha",
52 "uploader": "Green Gold",
53 "release_date": "20090101",
54 "upload_date": "20090101",
55 "timestamp": 1230768000,
56 "thumbnail": "https://akamaividz.zee5.com/resources/0-1-233402/list/270x152/01233402_list.jpg",
57 "series": "Krishna Balram",
66 'url': 'https://www.zee5.com/hi/tvshows/details/kundali-bhagya/0-6-366/kundali-bhagya-march-08-2021/0-1-manual_7g9jv1os7730?country=IN',
70 def _real_extract(self
, url
):
71 video_id
, display_id
= re
.match(self
._VALID
_URL
, url
).group('id', 'display_id')
72 access_token_request
= self
._download
_json
(
73 'https://useraction.zee5.com/token/platform_tokens.php?platform_name=web_app',
74 video_id
, note
="Downloading access token")
75 token_request
= self
._download
_json
(
76 'https://useraction.zee5.com/tokennd',
77 video_id
, note
="Downloading video token")
78 json_data
= self
._download
_json
(
79 'https://gwapi.zee5.com/content/details/{}?translation=en&country=IN'.format(video_id
),
80 video_id
, headers
={'X-Access-Token': access_token_request['token']}
)
83 (lambda x
: x
['hls'][0], lambda x
: x
['video_details']['hls_url']),
85 formats
= self
._extract
_m
3u8_formats
(
86 'https://zee5vodnd.akamaized.net' + m3u8_url
.replace('/drm1/', '/hls1/') + token_request
['video_token'],
87 video_id
, fatal
=False)
90 (lambda x
: x
['video'][0], lambda x
: x
['video_details']['url']),
92 formats
+= self
._extract
_mpd
_formats
(
93 'https://zee5vodnd.akamaized.net' + mpd_url
+ token_request
['video_token'],
94 video_id
, fatal
=False)
96 self
._sort
_formats
(formats
)
99 'display_id': display_id
,
100 'title': json_data
['title'],
102 'duration': int_or_none(json_data
.get('duration')),
103 'average_rating': int_or_none(json_data
.get('rating')),
104 'description': str_or_none(json_data
.get('description')),
105 'alt_title': str_or_none(json_data
.get('original_title')),
106 'uploader': str_or_none(json_data
.get('content_owner')),
107 'age_limit': parse_age_limit(json_data
.get('age_rating')),
108 'release_date': unified_strdate(json_data
.get('release_date')),
109 'timestamp': unified_timestamp(json_data
.get('release_date')),
110 'thumbnail': url_or_none(json_data
.get('image_url')),
111 'series': try_get(json_data
, lambda x
: x
['tvshow_details']['title'], str),
112 'season': try_get(json_data
, lambda x
: x
['season_details']['title'], str),
113 'season_number': int_or_none(try_get(json_data
, lambda x
: x
['season_details']['index'])),
114 'episode_number': int_or_none(try_get(json_data
, lambda x
: x
['index'])),
115 'tags': try_get(json_data
, lambda x
: x
['tags'], list)