Repository: yt-dlp/yt-dlp
File: yt_dlp/extractor/mxplayer.py (Python)

Code before:
            'format': 'bv',
            'skip_download': True,
        },
    }]

    def _real_extract(self, url):
        video_type, display_id, video_id = self._match_valid_url(url).groups()

        if 'show' in video_type:
            video_type = 'episode'

        API_URL = f'https://api.mxplay.com/v1/web/detail/video?type={video_type}&id={video_id}'
        STREAM_URL = 'https://llvod.mxplay.com/{}'

        data_json = self._download_json(API_URL, display_id)

        title = data_json['title']
        duration = data_json.get('duration')
        formats = []
        subtitles = {}
        description = data_json.get('description')
        series, season, season_number, episode_number = None, None, None, None

        if video_type == 'episode':
            series = data_json.get('container').get('container').get('title')
            season = data_json.get('container').get('title')
            episode_number = data_json.get('sequence')

            if season:
                match = re.match(r'Season (?P<season_number>\d+)', season)
                if match:
                    season_number = int(match.group('season_number'))

        for key in 'dash', 'hls':
            playlist_url = STREAM_URL.format(data_json['stream'][key]['high'])

            if key == 'dash':
                frmt, subs = self._extract_mpd_formats_and_subtitles(playlist_url, display_id, fatal=False)
            else:
                frmt, subs = self._extract_m3u8_formats_and_subtitles(playlist_url, display_id, fatal=False)

            formats.extend(frmt)
            subtitles = self._merge_subtitles(subtitles, subs)

        self._sort_formats(formats)

        return {
            'id': video_id,
            'title': title,
            'formats': formats,
            'subtitles': subtitles,

Review comment (suggestion):
Use traverse_obj

```python
series = traverse_obj(data_json, ('container', 'container', 'title'))
season = traverse_obj(data_json, ('container', 'title'))
```

Code after:
            'duration': 5970,
        },
        'params': {
            'format': 'bv',
            'skip_download': True,
        },
        'skip': 'No longer available',
    }, {
        'url': 'https://www.mxplayer.in/show/watch-shaitaan/season-1/the-infamous-taxi-gang-of-meerut-online-45055d5bcff169ad48f2ad7552a83d6c',
        'info_dict': {
            'id': '45055d5bcff169ad48f2ad7552a83d6c',
            'ext': 'mp4',
            'title': 'The infamous taxi gang of Meerut',
            'description': 'md5:033a0a7e3fd147be4fb7e07a01a3dc28',
            'season_number': 1,
            'episode_number': 1,
            'duration': 2332,
            'season': 'Season 1',
            'series': 'Shaitaan',
            'episode': 'Episode 1'
        },
        'params': {
            'format': 'best',
            'skip_download': True,
        },
        'skip': 'No longer available.'
    }, {
        'url': 'https://www.mxplayer.in/show/watch-aashram/chapter-1/duh-swapna-online-d445579792b0135598ba1bc9088a84cb',
        'info_dict': {
            'id': 'd445579792b0135598ba1bc9088a84cb',
            'display_id': 'duh-swapna-online',
            'ext': 'mp4',
            'title': 'Duh Swapna',
            'description': 'md5:35ff39c4bdac403c53be1e16a04192d8',
            'season_number': 1,
            'episode_number': 3,
            'duration': 2568,
            'season': 'Season 1',
            'series': 'Aashram',
            'episode': 'Episode 3'
        },
        'params': {
            'format': 'bv',
            'skip_download': True,
        },
    }, {
        'url': 'https://www.mxplayer.in/show/watch-dangerous/season-1/chapter-1-online-5a351b4f9fb69436f6bd6ae3a1a75292',
        'info_dict': {
            'id': '5a351b4f9fb69436f6bd6ae3a1a75292',
            'display_id': 'chapter-1-online',
            'ext': 'mp4',