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

Code before:
        },
        'playlist_count': 2,
    }, {
        'url': 'https://www.bfmtv.com/international/pour-bolsonaro-le-bresil-est-en-faillite-mais-il-ne-peut-rien-faire_AD-202101060232.html',
        'only_matching': True,
    }, {
        'url': 'https://www.bfmtv.com/sante/covid-19-oui-le-vaccin-de-pfizer-distribue-en-france-a-bien-ete-teste-sur-des-personnes-agees_AN-202101060275.html',
        'only_matching': True,
    }, {
        'url': 'https://rmc.bfmtv.com/actualites/societe/transports/ce-n-est-plus-tout-rentable-le-bioethanol-e85-depasse-1eu-le-litre-des-automobilistes-regrettent_AV-202301100268.html',
        'info_dict': {
            'id': '6318445464112',
            'ext': 'mp4',
            'title': 'Le plein de bioéthanol fait de plus en plus mal à la pompe',
            'uploader_id': '876630703001',
            'upload_date': '20230110',
            'timestamp': 1673341692,
            'duration': 109.269,
            'tags': ['rmc', 'show', 'apolline de malherbe', 'info', 'talk', 'matinale', 'radio'],
            'thumbnail': 'https://cf-images.eu-west-1.prod.boltdns.net/v1/static/876630703001/5bef74b8-9d5e-4480-a21f-60c2e2480c46/96c88b74-f9db-45e1-8040-e199c5da216c/1920x1080/match/image.jpg',
        },
    }]

    def _entries(self, webpage):
        yield from traverse_obj(
            re.findall(self._VIDEO_BLOCK_REGEX, webpage), (..., {self._extract_video}, filter, all))

    def _real_extract(self, url):
        bfmtv_id = self._match_id(url)
        webpage = self._download_webpage(url, bfmtv_id)

        return self.playlist_result(
            self._entries(webpage), bfmtv_id, self._og_search_title(webpage, fatal=False),
            self._html_search_meta(['og:description', 'description'], webpage))


Review comment (suggestion):
This makes only little sense since `traverse_obj` returns a list, always. Probably bad design, but compat and cannot be changed

Code after:
        'playlist_count': 2,
    }, {
        'url': 'https://www.bfmtv.com/international/pour-bolsonaro-le-bresil-est-en-faillite-mais-il-ne-peut-rien-faire_AD-202101060232.html',
        'only_matching': True,
    }, {
        'url': 'https://www.bfmtv.com/sante/covid-19-oui-le-vaccin-de-pfizer-distribue-en-france-a-bien-ete-teste-sur-des-personnes-agees_AN-202101060275.html',
        'only_matching': True,
    }, {
        'url': 'https://rmc.bfmtv.com/actualites/societe/transports/ce-n-est-plus-tout-rentable-le-bioethanol-e85-depasse-1eu-le-litre-des-automobilistes-regrettent_AV-202301100268.html',
        'info_dict': {
            'id': '6318445464112',
            'ext': 'mp4',
            'title': 'Le plein de bioéthanol fait de plus en plus mal à la pompe',
            'uploader_id': '876630703001',
            'upload_date': '20230110',
            'timestamp': 1673341692,
            'duration': 109.269,
            'tags': ['rmc', 'show', 'apolline de malherbe', 'info', 'talk', 'matinale', 'radio'],
            'thumbnail': 'https://cf-images.eu-west-1.prod.boltdns.net/v1/static/876630703001/5bef74b8-9d5e-4480-a21f-60c2e2480c46/96c88b74-f9db-45e1-8040-e199c5da216c/1920x1080/match/image.jpg',
        },
    }]

    def _entries(self, webpage):
        for video_block_el in re.findall(self._VIDEO_BLOCK_REGEX, webpage):
            video = self._extract_video(video_block_el)
            if video:
                yield video

    def _real_extract(self, url):
        bfmtv_id = self._match_id(url)
        webpage = self._download_webpage(url, bfmtv_id)

        return self.playlist_result(
            self._entries(webpage), bfmtv_id, self._og_search_title(webpage, fatal=False),
            self._html_search_meta(['og:description', 'description'], webpage))