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

Code before:
        formats = []
        for ext, ext_info in (video.get('ua') or {}).items():
            if isinstance(ext_info, dict):
                for height, video_info in ext_info.items():
                    if not traverse_obj(video_info, ('meta', 'h', {int_or_none})):
                        video_info.setdefault('meta', {})['h'] = height
                ext_info = ext_info.values()

            for video_info in ext_info:
                meta = video_info.get('meta') or {}
                if not video_info.get('url'):
                    continue
                # With default query parms returns m3u8 varients which are duplicates, without returns tar files
                if ext == 'tar':
                    continue
                if ext == 'hls':
                    if meta.get('live') is True and video.get('live') == 1:
                        live_status = 'post_live'
                    formats.extend(self._extract_m3u8_formats(
                        video_info['url'], video_id,
                        ext='mp4', m3u8_id='hls', fatal=False, live=live_status == 'is_live'))
                    continue
                is_timeline = ext == 'timeline'
                is_audio = ext == 'audio'
                formats.append({
                    'ext': determine_ext(video_info['url']),
                    'acodec': 'none' if is_timeline else None,
                    'vcodec': 'none' if is_audio else None,
                    'url': video_info['url'],
                    'format_id': join_nonempty(ext, format_field(meta, 'h', '%sp')),
                    'format_note': 'Timeline' if is_timeline else None,
                    'fps': None if is_timeline or is_audio else video.get('fps'),
                    **traverse_obj(meta, {
                        'tbr': ('bitrate', {int_or_none}),
                        'filesize': ('size', {int_or_none}),
                        'width': ('w', {int_or_none}),
                        'height': ('h', {int_or_none}),
                    }),
                })

        subtitles = {
            lang: [{
                'url': sub_info['path'],
                'name': sub_info.get('language') or '',
            }] for lang, sub_info in (video.get('cc') or {}).items() if sub_info.get('path')
        }

        author = video.get('author') or {}
        thumbnails = traverse_obj(video, ('t', ..., {'url': 'i', 'width': 'w', 'height': 'h'}))
        if not thumbnails and video.get('i'):
            thumbnails = [{'url': video['i']}]

Review comment (suggestion):
Unnecessary; core code does this. The old code would use the `ext` var here if it wasn't "timeline" -- should we do the same if it isn't "timeline" or "audio"?
```suggestion
                    'ext': ext if not (is_timeline or is_audio) else None,
```

Code after:
        for format_type, format_info in (video.get('ua') or {}).items():
            if isinstance(format_info, dict):
                for height, video_info in format_info.items():
                    if not traverse_obj(video_info, ('meta', 'h', {int_or_none})):
                        video_info.setdefault('meta', {})['h'] = height
                format_info = format_info.values()

            for video_info in format_info:
                meta = video_info.get('meta') or {}
                if not video_info.get('url'):
                    continue
                # With default query params returns m3u8 variants which are duplicates, without returns tar files
                if format_type == 'tar':
                    continue
                if format_type == 'hls':
                    if meta.get('live') is True and video.get('live') == 1:
                        live_status = 'post_live'
                    formats.extend(self._extract_m3u8_formats(
                        video_info['url'], video_id,
                        ext='mp4', m3u8_id='hls', fatal=False, live=live_status == 'is_live'))
                    continue
                is_timeline = format_type == 'timeline'
                is_audio = format_type == 'audio'
                formats.append({
                    'acodec': 'none' if is_timeline else None,
                    'vcodec': 'none' if is_audio else None,
                    'url': video_info['url'],
                    'format_id': join_nonempty(format_type, format_field(meta, 'h', '%sp')),
                    'format_note': 'Timeline' if is_timeline else None,
                    'fps': None if is_timeline or is_audio else video.get('fps'),
                    **traverse_obj(meta, {
                        'tbr': ('bitrate', {int_or_none}),
                        'filesize': ('size', {int_or_none}),
                        'width': ('w', {int_or_none}),
                        'height': ('h', {int_or_none}),
                    }),
                })

        subtitles = {
            lang: [{
                'url': sub_info['path'],
                'name': sub_info.get('language') or '',
            }] for lang, sub_info in (video.get('cc') or {}).items() if sub_info.get('path')
        }

        author = video.get('author') or {}
        thumbnails = traverse_obj(video, ('t', ..., {'url': 'i', 'width': 'w', 'height': 'h'}))
        if not thumbnails and video.get('i'):
            thumbnails = [{'url': video['i']}]

        if live_status in {'is_live', 'post_live'}: