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

Code before:
        sys_msg = traverse_obj(video, ('sys', 'msg'))
        if sys_msg:
            self.report_warning(sys_msg, video_id=video_id)

        if video.get('live') == 0:
            live_status = 'not_live' if video.get('livestream_has_dvr') is None else 'was_live'
        elif video.get('live') == 1:
            live_status = 'is_upcoming' if video.get('livestream_has_dvr') else 'was_live'
        elif video.get('live') == 2:
            live_status = 'is_live'
        else:
            live_status = None

        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}),
                    }),

Review comment (refactor):
sp
```suggestion
                # With default query params returns m3u8 variants which are duplicates, without returns tar files
```

Code after:
        if sys_msg:
            self.report_warning(sys_msg, video_id=video_id)

        if video.get('live') == 0:
            live_status = 'not_live' if video.get('livestream_has_dvr') is None else 'was_live'
        elif video.get('live') == 1:
            live_status = 'is_upcoming' if video.get('livestream_has_dvr') else 'was_live'
        elif video.get('live') == 2:
            live_status = 'is_live'
        else:
            live_status = None

        formats = []
        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}),
                    }),
                })