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

Code before:
            'language': 'hin',
            'categories': ['Drama'],
            'asset_type': 'ORIGINAL',
            'age_limit': 13,
            'content_discriptor': 'Frightening Scenes',
        },
    }, {
        # Streams/Clips
        'url': 'https://www.mzaalo.com/play/clip/83cdbcb5-400a-42f1-a1d2-459053cfbda5/Manto-Ki-Kahaaniya',
        'md5': '9a20e6603c83a799543af8ec1a52d7ef',
        'info_dict': {
            'id': '83cdbcb5-400a-42f1-a1d2-459053cfbda5',
            'title': 'Manto Ki Kahaaniya',
            'ext': 'mp4',
            'description': 'md5:c3c5f1d05f0fd1bfcb05b673d1cc9f2f',
            'thumbnails': 'count:3',
            'thumbnail': r're:^https?://.*\.jpg$',
            'duration': 1937.0,
            'language': 'Hin',
            'asset_type': 'CLIP',
        },
    }]

    def _real_extract(self, url):
        video_id, type_ = self._match_valid_url(url).group('id', 'type')
        path = f'partner/streamurl?&assetId={video_id}&getClipDetails=YES' if type_ == 'clip' else f'api/v2/player/details?assetType={type_.upper()}&assetId={video_id}'
        data = self._download_json(
            f'https://production.mzaalo.com/platform/{path}', video_id, headers={
                'Ocp-Apim-Subscription-Key': '1d0caac2702049b89a305929fdf4cbae',
            })['data']
        formats, subtitles = self._extract_m3u8_formats_and_subtitles(data["streamURL"], video_id)

        return {
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            **traverse_obj(data, {
                'title': ('title', {str}),
                'description': ('description', {str}),
                'duration': ('duration', {parse_duration}),
                'age_limit': ('maturity_rating', {parse_age_limit}),
                'thumbnails': ('images', ..., {'url': {url_or_none}}),
                'categories': ('genre', ..., {str}),
                'language': ('language', {str}),
                'asset_type': ('asset_type', {str}),
                'content_discriptor': ('content_descriptor', {str}),
            }),
        }


Review comment (refactor):
```suggestion
        path = (f'partner/streamurl?&assetId={video_id}&getClipDetails=YES' if type_ == 'clip'
                else f'api/v2/player/details?assetType={type_.upper()}&assetId={video_id}')
```
line too long

Code after:
        },
        'params': {'skip_download': 'm3u8'}
    }, {
        # Streams/Clips
        'url': 'https://www.mzaalo.com/play/clip/83cdbcb5-400a-42f1-a1d2-459053cfbda5/Manto-Ki-Kahaaniya',
        'info_dict': {
            'id': '83cdbcb5-400a-42f1-a1d2-459053cfbda5',
            'title': 'Manto Ki Kahaaniya',
            'ext': 'mp4',
            'description': 'md5:c3c5f1d05f0fd1bfcb05b673d1cc9f2f',
            'thumbnails': 'count:3',
            'thumbnail': r're:^https?://.*\.jpg$',
            'duration': 1937.0,
            'language': 'hin',
        },
        'params': {'skip_download': 'm3u8'}
    }]

    def _real_extract(self, url):
        video_id, type_ = self._match_valid_url(url).group('id', 'type')
        path = (f'partner/streamurl?&assetId={video_id}&getClipDetails=YES' if type_ == 'clip'
                else f'api/v2/player/details?assetType={type_.upper()}&assetId={video_id}')
        data = self._download_json(
            f'https://production.mzaalo.com/platform/{path}', video_id, headers={
                'Ocp-Apim-Subscription-Key': '1d0caac2702049b89a305929fdf4cbae',
            })['data']

        formats = self._extract_m3u8_formats(data['streamURL'], video_id)

        subtitles = {}
        for subs_lang, subs_url in traverse_obj(data, ('subtitles', {dict.items}, ...)):
            if url_or_none(subs_url):
                subtitles[subs_lang] = [{'url': subs_url, 'ext': 'vtt'}]

        lang = traverse_obj(data, ('language', {str.lower}))
        for f in formats:
            f['language'] = lang

        return {
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            **traverse_obj(data, {
                'title': ('title', {str}),
                'description': ('description', {str}),
                'duration': ('duration', {parse_duration}),
                'age_limit': ('maturity_rating', {parse_age_limit}),
                'thumbnails': ('images', ..., {'url': {url_or_none}}),
                'categories': ('genre', ..., {str}),
            }),
        }