2020-12-02 22:45:26 +00:00
|
|
|
from .common import InfoExtractor
|
2021-04-26 02:42:51 +00:00
|
|
|
from ..compat import compat_str
|
2022-09-30 18:03:30 +00:00
|
|
|
from ..utils import (
|
|
|
|
int_or_none,
|
|
|
|
traverse_obj,
|
|
|
|
try_get,
|
|
|
|
)
|
2020-12-02 22:45:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
class MxplayerIE(InfoExtractor):
|
2021-09-14 20:53:36 +00:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/(?P<type>movie|show/[-\w]+/[-\w]+)/(?P<display_id>[-\w]+)-(?P<id>\w+)'
|
2021-03-05 19:41:02 +00:00
|
|
|
_TESTS = [{
|
2021-09-14 20:53:36 +00:00
|
|
|
'url': 'https://www.mxplayer.in/show/watch-my-girlfriend-is-an-alien-hindi-dubbed/season-1/episode-1-online-9d2013d31d5835bb8400e3b3c5e7bb72',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '9d2013d31d5835bb8400e3b3c5e7bb72',
|
2022-09-30 18:03:30 +00:00
|
|
|
'display_id': 'episode-1-online',
|
2021-09-14 20:53:36 +00:00
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Episode 1',
|
|
|
|
'description': 'md5:62ed43eb9fec5efde5cf3bd1040b7670',
|
|
|
|
'season_number': 1,
|
|
|
|
'episode_number': 1,
|
|
|
|
'duration': 2451,
|
|
|
|
'season': 'Season 1',
|
|
|
|
'series': 'My Girlfriend Is An Alien (Hindi Dubbed)',
|
|
|
|
'episode': 'Episode 1'
|
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'format': 'bv',
|
|
|
|
'skip_download': True,
|
|
|
|
},
|
|
|
|
}, {
|
2020-12-02 22:45:26 +00:00
|
|
|
'url': 'https://www.mxplayer.in/movie/watch-knock-knock-hindi-dubbed-movie-online-b9fa28df3bfb8758874735bbd7d2655a?watch=true',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'b9fa28df3bfb8758874735bbd7d2655a',
|
2022-09-30 18:03:30 +00:00
|
|
|
'display_id': 'episode-1-online',
|
2020-12-02 22:45:26 +00:00
|
|
|
'ext': 'mp4',
|
2021-03-05 19:41:02 +00:00
|
|
|
'title': 'Knock Knock (Hindi Dubbed)',
|
2022-09-30 18:03:30 +00:00
|
|
|
'description': 'md5:4160f2dfc3b87c524261366f6b736329',
|
2021-09-14 20:53:36 +00:00
|
|
|
'duration': 5970,
|
2020-12-02 22:45:26 +00:00
|
|
|
},
|
|
|
|
'params': {
|
2021-09-14 20:53:36 +00:00
|
|
|
'format': 'bv',
|
2020-12-02 22:45:26 +00:00
|
|
|
'skip_download': True,
|
2021-09-14 20:53:36 +00:00
|
|
|
},
|
2022-09-30 18:03:30 +00:00
|
|
|
'skip': 'No longer available',
|
2021-03-05 19:41:02 +00:00
|
|
|
}, {
|
|
|
|
'url': 'https://www.mxplayer.in/show/watch-shaitaan/season-1/the-infamous-taxi-gang-of-meerut-online-45055d5bcff169ad48f2ad7552a83d6c',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '45055d5bcff169ad48f2ad7552a83d6c',
|
2021-09-14 20:53:36 +00:00
|
|
|
'ext': 'mp4',
|
2021-03-05 19:41:02 +00:00
|
|
|
'title': 'The infamous taxi gang of Meerut',
|
|
|
|
'description': 'md5:033a0a7e3fd147be4fb7e07a01a3dc28',
|
2021-09-14 20:53:36 +00:00
|
|
|
'season_number': 1,
|
|
|
|
'episode_number': 1,
|
|
|
|
'duration': 2332,
|
2021-03-05 19:41:02 +00:00
|
|
|
'season': 'Season 1',
|
2021-09-14 20:53:36 +00:00
|
|
|
'series': 'Shaitaan',
|
|
|
|
'episode': 'Episode 1'
|
2021-03-05 19:41:02 +00:00
|
|
|
},
|
|
|
|
'params': {
|
2021-09-14 20:53:36 +00:00
|
|
|
'format': 'best',
|
2021-03-05 19:41:02 +00:00
|
|
|
'skip_download': True,
|
2021-09-14 20:53:36 +00:00
|
|
|
},
|
2022-09-30 18:03:30 +00:00
|
|
|
'skip': 'No longer available.'
|
2021-03-05 19:41:02 +00:00
|
|
|
}, {
|
|
|
|
'url': 'https://www.mxplayer.in/show/watch-aashram/chapter-1/duh-swapna-online-d445579792b0135598ba1bc9088a84cb',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'd445579792b0135598ba1bc9088a84cb',
|
2022-09-30 18:03:30 +00:00
|
|
|
'display_id': 'duh-swapna-online',
|
2021-03-05 19:41:02 +00:00
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Duh Swapna',
|
|
|
|
'description': 'md5:35ff39c4bdac403c53be1e16a04192d8',
|
2021-09-14 20:53:36 +00:00
|
|
|
'season_number': 1,
|
|
|
|
'episode_number': 3,
|
|
|
|
'duration': 2568,
|
2022-09-30 18:03:30 +00:00
|
|
|
'season': 'Season 1',
|
2021-09-14 20:53:36 +00:00
|
|
|
'series': 'Aashram',
|
|
|
|
'episode': 'Episode 3'
|
2021-03-05 19:41:02 +00:00
|
|
|
},
|
|
|
|
'params': {
|
2021-09-14 20:53:36 +00:00
|
|
|
'format': 'bv',
|
2021-03-05 19:41:02 +00:00
|
|
|
'skip_download': True,
|
2021-09-14 20:53:36 +00:00
|
|
|
},
|
|
|
|
}, {
|
|
|
|
'url': 'https://www.mxplayer.in/show/watch-dangerous/season-1/chapter-1-online-5a351b4f9fb69436f6bd6ae3a1a75292',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '5a351b4f9fb69436f6bd6ae3a1a75292',
|
2022-09-30 18:03:30 +00:00
|
|
|
'display_id': 'chapter-1-online',
|
2021-09-14 20:53:36 +00:00
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'Chapter 1',
|
|
|
|
'description': 'md5:233886b8598bc91648ac098abe1d288f',
|
|
|
|
'season_number': 1,
|
|
|
|
'episode_number': 1,
|
|
|
|
'duration': 1305,
|
|
|
|
'season': 'Season 1',
|
|
|
|
'series': 'Dangerous',
|
|
|
|
'episode': 'Episode 1'
|
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'format': 'bv',
|
|
|
|
'skip_download': True,
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
'url': 'https://www.mxplayer.in/movie/watch-the-attacks-of-2611-movie-online-0452f0d80226c398d63ce7e3ea40fa2d',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '0452f0d80226c398d63ce7e3ea40fa2d',
|
|
|
|
'ext': 'mp4',
|
|
|
|
'title': 'The Attacks of 26/11',
|
|
|
|
'description': 'md5:689bacd29e97b3f31eaf519eb14127e5',
|
|
|
|
'duration': 6085,
|
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'format': 'best',
|
|
|
|
'skip_download': True,
|
|
|
|
},
|
2022-09-30 18:03:30 +00:00
|
|
|
'skip': 'No longer available. Cannot be played on browser'
|
|
|
|
}, {
|
|
|
|
'url': 'https://www.mxplayer.in/movie/watch-kitne-door-kitne-paas-movie-online-a9e9c76c566205955f70d8b2cb88a6a2',
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'a9e9c76c566205955f70d8b2cb88a6a2',
|
|
|
|
'display_id': 'watch-kitne-door-kitne-paas-movie-online',
|
|
|
|
'title': 'Kitne Door Kitne Paas',
|
|
|
|
'duration': 8458,
|
|
|
|
'ext': 'mp4',
|
|
|
|
'description': 'md5:fb825f3c542513088024dcafef0921b4',
|
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'format': 'bv',
|
|
|
|
'skip_download': True,
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
'url': 'https://www.mxplayer.in/show/watch-ek-thi-begum-hindi/season-2/game-of-power-online-5e5305c28f1409847cdc4520b6ad77cf',
|
|
|
|
'info_dict': {
|
|
|
|
'id': '5e5305c28f1409847cdc4520b6ad77cf',
|
|
|
|
'display_id': 'game-of-power-online',
|
|
|
|
'title': 'Game Of Power',
|
|
|
|
'duration': 1845,
|
|
|
|
'ext': 'mp4',
|
|
|
|
'description': 'md5:1d0948d2a5312d7013792d53542407f9',
|
|
|
|
'series': 'Ek Thi Begum (Hindi)',
|
|
|
|
'season': 'Season 2',
|
|
|
|
'season_number': 2,
|
|
|
|
'episode': 'Episode 2',
|
|
|
|
'episode_number': 2,
|
|
|
|
},
|
|
|
|
'params': {
|
|
|
|
'format': 'bv',
|
|
|
|
'skip_download': True,
|
|
|
|
},
|
2021-03-05 19:41:02 +00:00
|
|
|
}]
|
2020-12-02 22:45:26 +00:00
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2022-09-30 18:03:30 +00:00
|
|
|
video_type, display_id, video_id = self._match_valid_url(url).group('type', 'display_id', 'id')
|
|
|
|
if 'show' in video_type:
|
|
|
|
video_type = 'episode'
|
2020-12-02 22:45:26 +00:00
|
|
|
|
2022-09-30 18:03:30 +00:00
|
|
|
data_json = self._download_json(
|
|
|
|
f'https://api.mxplay.com/v1/web/detail/video?type={video_type}&id={video_id}', display_id)
|
2020-12-02 22:45:26 +00:00
|
|
|
|
2022-09-30 18:03:30 +00:00
|
|
|
streams = traverse_obj(data_json, ('stream', {'m3u8': ('hls', 'high'), 'mpd': ('dash', 'high')}))
|
|
|
|
formats, dash_subs = self._extract_mpd_formats_and_subtitles(
|
|
|
|
f'https://llvod.mxplay.com/{streams["mpd"]}', display_id, fatal=False)
|
|
|
|
hls_frmts, hls_subs = self._extract_m3u8_formats_and_subtitles(
|
|
|
|
f'https://llvod.mxplay.com/{streams["m3u8"]}', display_id, fatal=False)
|
|
|
|
|
|
|
|
formats.extend(hls_frmts)
|
2020-12-02 22:45:26 +00:00
|
|
|
self._sort_formats(formats)
|
2022-09-30 18:03:30 +00:00
|
|
|
|
|
|
|
season = traverse_obj(data_json, ('container', 'title'))
|
2021-03-05 19:41:02 +00:00
|
|
|
return {
|
2020-12-02 22:45:26 +00:00
|
|
|
'id': video_id,
|
2022-09-30 18:03:30 +00:00
|
|
|
'title': data_json.get('title'),
|
|
|
|
'formats': formats,
|
|
|
|
'subtitles': self._merge_subtitles(dash_subs, hls_subs),
|
2021-04-26 02:42:51 +00:00
|
|
|
'display_id': display_id,
|
2021-09-14 20:53:36 +00:00
|
|
|
'duration': data_json.get('duration'),
|
2022-09-30 18:03:30 +00:00
|
|
|
'series': traverse_obj(data_json, ('container', 'container', 'title')),
|
|
|
|
'description': data_json.get('description'),
|
2021-09-14 20:53:36 +00:00
|
|
|
'season': season,
|
2022-09-30 18:03:30 +00:00
|
|
|
'season_number': int_or_none(
|
|
|
|
self._search_regex(r'Season (\d+)', season, 'Season Number', default=None)),
|
|
|
|
'episode_number': data_json.get('sequence') or None,
|
2020-12-02 22:45:26 +00:00
|
|
|
}
|
2021-04-26 02:42:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
class MxplayerShowIE(InfoExtractor):
|
2021-11-30 16:14:47 +00:00
|
|
|
_VALID_URL = r'https?://(?:www\.)?mxplayer\.in/show/(?P<display_id>[-\w]+)-(?P<id>\w+)/?(?:$|[#?])'
|
2021-04-26 02:42:51 +00:00
|
|
|
_TESTS = [{
|
|
|
|
'url': 'https://www.mxplayer.in/show/watch-chakravartin-ashoka-samrat-series-online-a8f44e3cc0814b5601d17772cedf5417',
|
|
|
|
'playlist_mincount': 440,
|
|
|
|
'info_dict': {
|
|
|
|
'id': 'a8f44e3cc0814b5601d17772cedf5417',
|
|
|
|
'title': 'Watch Chakravartin Ashoka Samrat Series Online',
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
|
|
|
|
_API_SHOW_URL = "https://api.mxplay.com/v1/web/detail/tab/tvshowseasons?type=tv_show&id={}&device-density=2&platform=com.mxplay.desktop&content-languages=hi,en"
|
|
|
|
_API_EPISODES_URL = "https://api.mxplay.com/v1/web/detail/tab/tvshowepisodes?type=season&id={}&device-density=1&platform=com.mxplay.desktop&content-languages=hi,en&{}"
|
|
|
|
|
|
|
|
def _entries(self, show_id):
|
|
|
|
show_json = self._download_json(
|
|
|
|
self._API_SHOW_URL.format(show_id),
|
|
|
|
video_id=show_id, headers={'Referer': 'https://mxplayer.in'})
|
|
|
|
page_num = 0
|
|
|
|
for season in show_json.get('items') or []:
|
|
|
|
season_id = try_get(season, lambda x: x['id'], compat_str)
|
|
|
|
next_url = ''
|
|
|
|
while next_url is not None:
|
|
|
|
page_num += 1
|
|
|
|
season_json = self._download_json(
|
|
|
|
self._API_EPISODES_URL.format(season_id, next_url),
|
|
|
|
video_id=season_id,
|
|
|
|
headers={'Referer': 'https://mxplayer.in'},
|
|
|
|
note='Downloading JSON metadata page %d' % page_num)
|
|
|
|
for episode in season_json.get('items') or []:
|
|
|
|
video_url = episode['webUrl']
|
|
|
|
yield self.url_result(
|
|
|
|
'https://mxplayer.in%s' % video_url,
|
|
|
|
ie=MxplayerIE.ie_key(), video_id=video_url.split('-')[-1])
|
|
|
|
next_url = season_json.get('next')
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2021-08-19 01:41:24 +00:00
|
|
|
display_id, show_id = self._match_valid_url(url).groups()
|
2021-04-26 02:42:51 +00:00
|
|
|
return self.playlist_result(
|
|
|
|
self._entries(show_id), playlist_id=show_id,
|
|
|
|
playlist_title=display_id.replace('-', ' ').title())
|