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

Code before:
                    if not isinstance(format_list, list):
                        format_list = [format_list]
                    for format_url in format_list:
                        format_url = url_or_none(format_url)
                        if not format_url:
                            continue
                        if format_id == 'hls':
                            formats.extend(self._extract_m3u8_formats(
                                format_url, video_id, ext='mp4',
                                entry_protocol='m3u8_native', m3u8_id='hls',
                                fatal=False))
                            continue
                        f = {
                            'url': format_url,
                        }
                        f_id = format_id
                        for quality in QUALITIES:
                            if '%s.mp4' % quality in format_url:
                                f_id += '-%s' % quality
                                f.update({
                                    'quality': quality_key(quality),
                                    'format_note': quality.upper(),
                                })
                                break
                        f['format_id'] = f_id
                        formats.append(f)

        if not formats and drm_formats:
            self.report_drm(video_id)

        title = self._og_search_title(
            webpage, default=None) or self._search_regex(
            (r'<value>(?P<title>[^<]+)',
             r'videoTitle\s*:\s*(["\'])(?P<value>(?:(?!\1).)+)\1'), webpage,
            'title', group='value')
        thumbnail = self._og_search_thumbnail(
            webpage, default=None) or self._search_regex(
            r'poster\s*:\s*(["\'])(?P<value>(?:(?!\1).)+)\1', webpage,
            'thumbnail', fatal=False, group='value')
        duration = int_or_none(self._search_regex(
            r'videoDuration\s*:\s*(\d+)', webpage, 'duration',
            default=duration))

        return {
            'id': video_id,
            'title': title,
            'thumbnail': thumbnail,
            'duration': duration,
            'formats': formats,
        }


Review comment (refactor):
This could probably be refactored with `traverse_obj`, or perhaps `process_format_list` could be generalized more and that could be used here

But since this is old code that you are just indenting, you don't need to change it

```suggestion
                for format_id, format_list in traverse_obj(bitrates, ({dict.items}, ...)):
                    for format_url in traverse_obj(variadic(format_list), lambda _, v: url_or_none(v)):
                        if format_id == 'hls':
                            formats.extend(self._extract_m3u8_formats(
                                format_url, video_id, ext='mp4', m3u8_id='hls', fatal=False))
                            continue
                        f = {'url': format_url}
                        f_id = format_id
                        for quality in QUALITIES:
                            if '%s.mp4' % quality in format_url:
                                f_id += '-%s' % quality
                                f.update({
                                    'quality': quality_key(quality),
                                    'format_note': quality.upper(),
                                })
                                break
                        f['format_id'] = f_id
                        formats.append(f)
```

Code after:
            'thumbnail', fatal=False, group='value')
        duration = int_or_none(self._search_regex(
            r'videoDuration\s*:\s*(\d+)', webpage, 'duration',
            default=duration))

        return {
            'id': video_id,
            'title': title,
            'thumbnail': thumbnail,
            'duration': duration,
            'formats': formats,
        }


class NovaIE(InfoExtractor):
    IE_DESC = 'TN.cz, Prásk.tv, Nova.cz, Novaplus.cz, FANDA.tv, Krásná.cz and Doma.cz'
    _VALID_URL = r'https?://(?:[^.]+\.)?(?P<site>tv(?:noviny)?|tn|novaplus|vymena|fanda|krasna|doma|prask)\.nova\.cz/(?:[^/]+/)+(?P<id>[^/]+?)(?:\.html|/|$)'
    _TESTS = [{
        'url': 'http://tn.nova.cz/clanek/tajemstvi-ukryte-v-podzemi-specialni-nemocnice-v-prazske-krci.html#player_13260',
        'md5': '249baab7d0104e186e78b0899c7d5f28',
        'info_dict': {
            'id': '1757139',
            'display_id': 'tajemstvi-ukryte-v-podzemi-specialni-nemocnice-v-prazske-krci',
            'ext': 'mp4',
            'title': 'Podzemní nemocnice v pražské Krči',
            'description': 'md5:f0a42dd239c26f61c28f19e62d20ef53',
            'thumbnail': r're:^https?://.*\.(?:jpg)',
        }
    }, {
        'url': 'http://fanda.nova.cz/clanek/fun-and-games/krvavy-epos-zaklinac-3-divoky-hon-vychazi-vyhrajte-ho-pro-sebe.html',
        'info_dict': {
            'id': '1753621',
            'ext': 'mp4',
            'title': 'Zaklínač 3: Divoký hon',
            'description': 're:.*Pokud se stejně jako my nemůžete.*',
            'thumbnail': r're:https?://.*\.jpg(\?.*)?',
            'upload_date': '20150521',
        },
        'params': {
            # rtmp download
            'skip_download': True,
        },
        'skip': 'gone',
    }, {
        # media.cms.nova.cz embed
        'url': 'https://novaplus.nova.cz/porad/ulice/epizoda/18760-2180-dil',
        'info_dict': {
            'id': '8o0n0r',
            'ext': 'mp4',
            'title': '2180. díl',
            'thumbnail': r're:^https?://.*\.jpg',