2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
18 class Zee5IE(InfoExtractor
):
19 _VALID_URL
= r
'https?://(?:www\.)?zee5\.com/[^#?]*/(?P<display_id>[-\w]+)/(?P<id>[-\d]+)'
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",
67 def _real_extract(self
, url
):
68 video_id
, display_id
= re
.match(self
._VALID
_URL
, url
).group('id', 'display_id')
69 access_token_request
= self
._download
_json
(
70 'https://useraction.zee5.com/token/platform_tokens.php?platform_name=web_app',
71 video_id
, note
="Downloading access token")
72 token_request
= self
._download
_json
(
73 'https://useraction.zee5.com/tokennd',
74 video_id
, note
="Downloading video token")
75 json_data
= self
._download
_json
(
76 'https://gwapi.zee5.com/content/details/{}?translation=en&country=IN'.format(video_id
),
77 video_id
, headers
={'X-Access-Token': access_token_request['token']}
)
80 (lambda x
: x
['hls'][0], lambda x
: x
['video_details']['hls_url']),
82 formats
= self
._extract
_m
3u8_formats
(
83 'https://zee5vodnd.akamaized.net' + m3u8_url
.replace('/drm1/', '/hls1/') + token_request
['video_token'],
84 video_id
, fatal
=False)
87 (lambda x
: x
['video'][0], lambda x
: x
['video_details']['url']),
89 formats
+= self
._extract
_mpd
_formats
(
90 'https://zee5vodnd.akamaized.net' + mpd_url
+ token_request
['video_token'],
91 video_id
, fatal
=False)
93 self
._sort
_formats
(formats
)
96 'display_id': display_id
,
97 'title': json_data
['title'],
99 'duration': int_or_none(json_data
.get('duration')),
100 'average_rating': int_or_none(json_data
.get('rating')),
101 'description': str_or_none(json_data
.get('description')),
102 'alt_title': str_or_none(json_data
.get('original_title')),
103 'uploader': str_or_none(json_data
.get('content_owner')),
104 'age_limit': parse_age_limit(json_data
.get('age_rating')),
105 'release_date': unified_strdate(json_data
.get('release_date')),
106 'timestamp': unified_timestamp(json_data
.get('release_date')),
107 'thumbnail': url_or_none(json_data
.get('image_url')),
108 'series': try_get(json_data
, lambda x
: x
['tvshow_details']['title'], str),
109 'season': try_get(json_data
, lambda x
: x
['season_details']['title'], str),
110 'season_number': int_or_none(try_get(json_data
, lambda x
: x
['season_details']['index'])),
111 'episode_number': int_or_none(try_get(json_data
, lambda x
: x
['index'])),
112 'tags': try_get(json_data
, lambda x
: x
['tags'], list)