aboutsummaryrefslogtreecommitdiffstats
path: root/hypervideo_dl/extractor/zee5.py
diff options
context:
space:
mode:
Diffstat (limited to 'hypervideo_dl/extractor/zee5.py')
-rw-r--r--hypervideo_dl/extractor/zee5.py117
1 files changed, 62 insertions, 55 deletions
diff --git a/hypervideo_dl/extractor/zee5.py b/hypervideo_dl/extractor/zee5.py
index 5366041..3e3f11b 100644
--- a/hypervideo_dl/extractor/zee5.py
+++ b/hypervideo_dl/extractor/zee5.py
@@ -21,9 +21,9 @@ class Zee5IE(InfoExtractor):
_VALID_URL = r'''(?x)
(?:
zee5:|
- (?:https?://)(?:www\.)?zee5\.com/(?:[^#?]+/)?
+ https?://(?:www\.)?zee5\.com/(?:[^#?]+/)?
(?:
- (?:tvshows|kids|zee5originals)(?:/[^#/?]+){3}
+ (?:tv-shows|kids|web-series|zee5originals)(?:/[^#/?]+){3}
|movies/[^#/?]+
)/(?P<display_id>[^#/?]+)/
)
@@ -37,48 +37,53 @@ class Zee5IE(InfoExtractor):
'display_id': 'krishna-the-birth',
'title': 'Krishna - The Birth',
'duration': 4368,
- 'average_rating': 4,
'description': compat_str,
'alt_title': 'Krishna - The Birth',
'uploader': 'Zee Entertainment Enterprises Ltd',
'release_date': '20060101',
'upload_date': '20060101',
'timestamp': 1136073600,
- 'thumbnail': 'https://akamaividz.zee5.com/resources/0-0-63098/list/270x152/0063098_list_80888170.jpg',
+ 'thumbnail': r're:^https?://.*\.jpg$',
+ 'episode_number': 0,
+ 'episode': 'Episode 0',
'tags': list
},
'params': {
'format': 'bv',
},
}, {
- 'url': 'https://zee5.com/tvshows/details/krishna-balram/0-6-1871/episode-1-the-test-of-bramha/0-1-233402',
+ 'url': 'https://www.zee5.com/kids/kids-shows/bandbudh-aur-budbak/0-6-1899/yoga-se-hoga-bandbudh-aur-budbak/0-1-239839',
'info_dict': {
- 'id': '0-1-233402',
+ 'id': '0-1-239839',
'ext': 'mp4',
- 'display_id': 'episode-1-the-test-of-bramha',
- 'title': 'Episode 1 - The Test Of Bramha',
- 'duration': 1336,
- 'average_rating': 4,
+ 'display_id': 'yoga-se-hoga-bandbudh-aur-budbak',
+ 'title': 'Yoga Se Hoga-Bandbudh aur Budbak',
+ 'duration': 659,
'description': compat_str,
- 'alt_title': 'Episode 1 - The Test Of Bramha',
+ 'alt_title': 'Yoga Se Hoga-Bandbudh aur Budbak',
'uploader': 'Zee Entertainment Enterprises Ltd',
- 'release_date': '20090101',
- 'upload_date': '20090101',
- 'timestamp': 1230768000,
- 'thumbnail': 'https://akamaividz.zee5.com/resources/0-1-233402/list/270x152/01233402_list.jpg',
- 'series': 'Krishna Balram',
+ 'release_date': '20150101',
+ 'upload_date': '20150101',
+ 'timestamp': 1420070400,
+ 'thumbnail': r're:^https?://.*\.jpg$',
+ 'series': 'Bandbudh Aur Budbak',
'season_number': 1,
'episode_number': 1,
+ 'episode': 'Episode 1',
+ 'season': 'Season 1',
'tags': list,
},
'params': {
'format': 'bv',
},
}, {
- 'url': 'https://www.zee5.com/hi/tvshows/details/kundali-bhagya/0-6-366/kundali-bhagya-march-08-2021/0-1-manual_7g9jv1os7730?country=IN',
+ 'url': 'https://www.zee5.com/hi/tv-shows/details/kundali-bhagya/0-6-366/kundali-bhagya-march-08-2021/0-1-manual_7g9jv1os7730?country=IN',
'only_matching': True
}, {
- 'url': 'https://www.zee5.com/global/hi/tvshows/details/kundali-bhagya/0-6-366/kundali-bhagya-march-08-2021/0-1-manual_7g9jv1os7730',
+ 'url': 'https://www.zee5.com/global/hi/tv-shows/details/kundali-bhagya/0-6-366/kundali-bhagya-march-08-2021/0-1-manual_7g9jv1os7730',
+ 'only_matching': True
+ }, {
+ 'url': 'https://www.zee5.com/web-series/details/mithya/0-6-4z587408/maine-dekhi-hai-uski-mrityu/0-1-6z587412',
'only_matching': True
}]
_DETAIL_API_URL = 'https://spapi.zee5.com/singlePlayback/getDetails?content_id={}&device_id={}&platform_name=desktop_web&country=IN&check_parental_control=false'
@@ -86,31 +91,29 @@ class Zee5IE(InfoExtractor):
_USER_TOKEN = None
_LOGIN_HINT = 'Use "--username <mobile_number>" to login using otp or "--username token" and "--password <user_token>" to login using user token.'
_NETRC_MACHINE = 'zee5'
+ _GEO_COUNTRIES = ['IN']
- def _login(self):
- username, password = self._get_login_info()
- if username:
- if len(username) == 10 and username.isdigit() and self._USER_TOKEN is None:
- self.report_login()
- otp_request_json = self._download_json('https://b2bapi.zee5.com/device/sendotp_v1.php?phoneno=91{}'.format(username),
- None, note='Sending OTP')
- if otp_request_json['code'] == 0:
- self.to_screen(otp_request_json['message'])
- else:
- raise ExtractorError(otp_request_json['message'], expected=True)
- otp_code = self._get_tfa_info('OTP')
- otp_verify_json = self._download_json('https://b2bapi.zee5.com/device/verifyotp_v1.php?phoneno=91{}&otp={}&guest_token={}&platform=web'.format(username, otp_code, self._DEVICE_ID),
- None, note='Verifying OTP', fatal=False)
- if not otp_verify_json:
- raise ExtractorError('Unable to verify OTP.', expected=True)
- self._USER_TOKEN = otp_verify_json.get('token')
- if not self._USER_TOKEN:
- raise ExtractorError(otp_request_json['message'], expected=True)
- elif username.lower() == 'token' and len(password) > 1198:
- self._USER_TOKEN = password
-
- def _real_initialize(self):
- self._login()
+ def _perform_login(self, username, password):
+ if len(username) == 10 and username.isdigit() and self._USER_TOKEN is None:
+ self.report_login()
+ otp_request_json = self._download_json('https://b2bapi.zee5.com/device/sendotp_v1.php?phoneno=91{}'.format(username),
+ None, note='Sending OTP')
+ if otp_request_json['code'] == 0:
+ self.to_screen(otp_request_json['message'])
+ else:
+ raise ExtractorError(otp_request_json['message'], expected=True)
+ otp_code = self._get_tfa_info('OTP')
+ otp_verify_json = self._download_json('https://b2bapi.zee5.com/device/verifyotp_v1.php?phoneno=91{}&otp={}&guest_token={}&platform=web'.format(username, otp_code, self._DEVICE_ID),
+ None, note='Verifying OTP', fatal=False)
+ if not otp_verify_json:
+ raise ExtractorError('Unable to verify OTP.', expected=True)
+ self._USER_TOKEN = otp_verify_json.get('token')
+ if not self._USER_TOKEN:
+ raise ExtractorError(otp_request_json['message'], expected=True)
+ elif username.lower() == 'token' and len(password) > 1198:
+ self._USER_TOKEN = password
+ else:
+ raise ExtractorError(self._LOGIN_HINT, expected=True)
def _real_extract(self, url):
video_id, display_id = self._match_valid_url(url).group('id', 'display_id')
@@ -153,7 +156,6 @@ class Zee5IE(InfoExtractor):
'formats': formats,
'subtitles': subtitles,
'duration': int_or_none(asset_data.get('duration')),
- 'average_rating': int_or_none(asset_data.get('rating')),
'description': str_or_none(asset_data.get('description')),
'alt_title': str_or_none(asset_data.get('original_title')),
'uploader': str_or_none(asset_data.get('content_owner')),
@@ -174,43 +176,48 @@ class Zee5SeriesIE(InfoExtractor):
_VALID_URL = r'''(?x)
(?:
zee5:series:|
- (?:https?://)(?:www\.)?zee5\.com/(?:[^#?]+/)?
- (?:tvshows|kids|zee5originals)(?:/[^#/?]+){2}/
+ https?://(?:www\.)?zee5\.com/(?:[^#?]+/)?
+ (?:tv-shows|web-series|kids|zee5originals)(?:/[^#/?]+){2}/
)
- (?P<id>[^#/?]+)/?(?:$|[?#])
+ (?P<id>[^#/?]+)(?:/episodes)?/?(?:$|[?#])
'''
_TESTS = [{
- 'url': 'https://www.zee5.com/kids/kids-shows/krishna-balram/0-6-1871',
- 'playlist_mincount': 43,
+ 'url': 'https://www.zee5.com/kids/kids-shows/bandbudh-aur-budbak/0-6-1899',
+ 'playlist_mincount': 156,
'info_dict': {
- 'id': '0-6-1871',
+ 'id': '0-6-1899',
},
}, {
- 'url': 'https://www.zee5.com/tvshows/details/bhabi-ji-ghar-par-hai/0-6-199',
+ 'url': 'https://www.zee5.com/tv-shows/details/bhabi-ji-ghar-par-hai/0-6-199',
'playlist_mincount': 1500,
'info_dict': {
'id': '0-6-199',
},
}, {
- 'url': 'https://www.zee5.com/tvshows/details/agent-raghav-crime-branch/0-6-965',
+ 'url': 'https://www.zee5.com/tv-shows/details/agent-raghav-crime-branch/0-6-965',
'playlist_mincount': 24,
'info_dict': {
'id': '0-6-965',
},
}, {
- 'url': 'https://www.zee5.com/ta/tvshows/details/nagabhairavi/0-6-3201',
+ 'url': 'https://www.zee5.com/ta/tv-shows/details/nagabhairavi/0-6-3201',
'playlist_mincount': 3,
'info_dict': {
'id': '0-6-3201',
},
}, {
- 'url': 'https://www.zee5.com/global/hi/tvshows/details/khwaabon-ki-zamin-par/0-6-270',
+ 'url': 'https://www.zee5.com/global/hi/tv-shows/details/khwaabon-ki-zamin-par/0-6-270',
'playlist_mincount': 150,
'info_dict': {
'id': '0-6-270',
},
- }
- ]
+ }, {
+ 'url': 'https://www.zee5.com/tv-shows/details/chala-hawa-yeu-dya-ladies-zindabaad/0-6-2943/episodes',
+ 'only_matching': True,
+ }, {
+ 'url': 'https://www.zee5.com/web-series/details/mithya/0-6-4z587408',
+ 'only_matching': True,
+ }]
def _entries(self, show_id):
access_token_request = self._download_json(