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

Code before:
            'subtitles': subtitles,
            'uploader': 'KIKA'
        }

    def _extract_formats(self, media_info, video_id):
        streams = media_info.get('assets', [])
        formats = []
        for num, media in enumerate(streams):
            stream_url = media.get("url")
            ext = determine_ext(stream_url)
            if ext == 'm3u8':
                formats.extend(self._extract_m3u8_formats(
                    stream_url, video_id, 'mp4', 'm3u8_native',
                    m3u8_id='hls', fatal=False))
            else:
                f = {
                    'url': stream_url,
                    'format_id': 'a%s-%s' % (num, ext),
                    'width': media.get('frameWidth'),
                    'height': media.get('frameHeight'),
                    'filesize': int_or_none(media.get('fileSize')),
                    'abr': int_or_none(media.get('bitrateAudio')),
                    'vbr': int_or_none(media.get('bitrateVideo')),
                }
                formats.append(f)
        return formats


Review comment (refactor):
```suggestion
    def _extract_formats(self, media_info, video_id):
        for media in media_info['assets']:
            stream_url = media.get('url')
            if not stream_url:
                continue
            ext = determine_ext(stream_url)
            if ext == 'm3u8':
                yield from self._extract_m3u8_formats(
                    stream_url, video_id, 'mp4', m3u8_id='hls', fatal=False))
            else:
                yield {
                    'url': stream_url,
                    'format_id': ext,
                    **traverse_obj(media, {
                        'width': 'frameWidth',
                        'height': 'frameHeight',
                        'filesize': 'fileSize',
                        'abr': 'bitrateAudio',
                        'vbr': 'bitrateVideo',
                    }, expected_type=int_on_none)
                }
```
cast into list when calling

Code after:
            'season': 'Season 1',
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)

        doc = self._download_json(f'https://www.kika.de/_next-api/proxy/v1/videos/{video_id}', video_id)
        video_assets = self._download_json(doc['assets']['url'], video_id)

        subtitles = {}
        if ttml_resource := url_or_none(video_assets.get('videoSubtitle')):
            subtitles['de'] = [{
                'url': ttml_resource,
                'ext': 'ttml',
            }]
        if webvtt_resource := url_or_none(video_assets.get('webvttUrl')):
            subtitles.setdefault('de', []).append({
                'url': webvtt_resource,
                'ext': 'vtt',
            })

        return {
            'id': video_id,
            'formats': list(self._extract_formats(video_assets, video_id)),
            'subtitles': subtitles,
            **traverse_obj(doc, {
                'title': ('title', {str}),
                'description': ('description', {str}),
                'timestamp': ('date', {parse_iso8601}),
                'modified_timestamp': ('modificationDate', {parse_iso8601}),
                'duration': ((
                    ('durationInSeconds', {int_or_none}),
                    ('duration', {parse_duration})), any),
                'episode_number': ('episodeNumber', {int_or_none}),
                'season_number': ('season', {int_or_none}),
            }),
        }

    def _extract_formats(self, media_info, video_id):
        for media in traverse_obj(media_info, ('assets', lambda _, v: url_or_none(v['url']))):
            stream_url = media['url']
            ext = determine_ext(stream_url)
            if ext == 'm3u8':
                yield from self._extract_m3u8_formats(
                    stream_url, video_id, 'mp4', m3u8_id='hls', fatal=False)
            else:
                yield {
                    'url': stream_url,
                    'format_id': ext,
                    **traverse_obj(media, {