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

Code before:
            if stream_type == 'dash':
                dash_formats = self._extract_mpd_formats(
                    format_url, video_id, mpd_id='dash-%s' % quality, headers={'Referer': url})
                for frmt in dash_formats:
                    frmt['quality'] = get_quality(quality)
                formats.extend(dash_formats)
            elif stream_type == 'hls':
                formats.extend(self._extract_m3u8_formats(
                    format_url, video_id, fatal=False,
                    m3u8_id='hls-%s' % quality, quality=get_quality(quality)))

        self._sort_formats(formats)
        return {
            'id': video_id,
            'display_id': display_id.replace('/', '-'),
            'title': video_dict['title'] or self._og_search_title(webpage),
            'formats': formats,
            'description': video_dict.get('description'),
            'season': try_get(video_dict, lambda x: x['container']['title']),
            'series': try_get(video_dict, lambda x: x['container']['container']['title']),
            'thumbnails': thumbnails,
        }


class MxplayerShowIE(InfoExtractor):
    _VALID_URL = r'(?:https?://)(?:www\.)?mxplayer\.in/show/(?P<display_id>[-\w]+)-(?P<id>\w+)/?(?:$|[#?])'
    _TESTS = [{
        'url': 'https://www.mxplayer.in/show/watch-chakravartin-ashoka-samrat-series-online-a8f44e3cc0814b5601d17772cedf5417',
        'playlist_mincount': 440,
        'info_dict': {
            'id': 'a8f44e3cc0814b5601d17772cedf5417',
        }
    }]

    def _entries(self, show_id):
        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".format(
            show_id)
        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&{}"
        show_json = self._download_json(show_url, 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(episodes_url.format(season_id, next_url),
                                                  video_id=season_id,
                                                  headers={'Referer': 'https://mxplayer.in'},
                                                  note='Downloading JSON metadata page %d' % page_num)
                next_url = season_json['next']
                for episode in season_json.get('items') or []:

Review comment (suggestion):
If `display_id` is never being used, don't capture it

Code after:
            if stream_type == 'dash':
                dash_formats = self._extract_mpd_formats(
                    format_url, video_id, mpd_id='dash-%s' % quality, headers={'Referer': url})
                for frmt in dash_formats:
                    frmt['quality'] = get_quality(quality)
                formats.extend(dash_formats)
            elif stream_type == 'hls':
                formats.extend(self._extract_m3u8_formats(
                    format_url, video_id, fatal=False,
                    m3u8_id='hls-%s' % quality, quality=get_quality(quality)))

        self._sort_formats(formats)
        return {
            'id': video_id,
            'display_id': display_id,
            'title': video_dict['title'] or self._og_search_title(webpage),
            'formats': formats,
            'description': video_dict.get('description'),
            'season': try_get(video_dict, lambda x: x['container']['title']),
            'series': try_get(video_dict, lambda x: x['container']['container']['title']),
            'thumbnails': thumbnails,
        }


class MxplayerShowIE(InfoExtractor):
    _VALID_URL = r'(?:https?://)(?:www\.)?mxplayer\.in/show/(?P<display_id>[-\w]+)-(?P<id>\w+)/?(?:$|[#?])'
    _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,