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

Code before:
            formats, subtitles = self._extract_mpd_formats_and_subtitles(
                main_source['url'], video_id, 'mp4', fatal=False)
        else:
            formats, subtitles = self._extract_m3u8_formats_and_subtitles(
                main_source['url'], video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=False)
        self._merge_subtitles(traverse_obj(main_source, ('text', ..., {
            'url': ('subtitle', 'srt', 'url', {str_or_none}),
        }, all, {subs_list_to_dict})), target=subtitles)

        return {
            'id': video_id,
            **traverse_obj(info, {
                'title': ('headline', {str}),
                'duration': ('duration', {float_or_none(scale=1000)}),
                'uploader': ('title', 'headline', {str}),
                'uploader_id': ('title', 'originProgramId', {str_or_none}),
                'episode_number': ('relatedEpisodeNumber', {int_or_none}),
                'season_number': ('relatedSeasonNumber', {int_or_none}),
            }),
            'formats': formats,
            'subtitles': subtitles,
        }


class GloboArticleIE(InfoExtractor):
    _VALID_URL = r'https?://(?!globoplay).+?\.globo\.com/(?:[^/]+/)*(?P<id>[^/.]+)(?:\.html)?'

    _VIDEOID_REGEXES = [
        r'\bdata-video-id=["\'](\d{7,})["\']',
        r'\bdata-player-videosids=["\'](\d{7,})["\']',
        r'\bvideosIDs\s*:\s*["\']?(\d{7,})',
        r'\bdata-id=["\'](\d{7,})["\']',
        r'<div[^>]+\bid=["\'](\d{7,})["\']',
        r'<bs-player[^>]+\bvideoid=["\'](\d{8,})["\']',
    ]

    _TESTS = [{
        'url': 'http://g1.globo.com/jornal-nacional/noticia/2014/09/novidade-na-fiscalizacao-de-bagagem-pela-receita-provoca-discussoes.html',
        'info_dict': {
            'id': 'novidade-na-fiscalizacao-de-bagagem-pela-receita-provoca-discussoes',
            'title': 'Novidade na fiscalização de bagagem pela Receita provoca discussões',
            'description': 'md5:c3c4b4d4c30c32fce460040b1ac46b12',
        },
        'playlist_count': 1,
    }, {
        'url': 'http://g1.globo.com/pr/parana/noticia/2016/09/mpf-denuncia-lula-marisa-e-mais-seis-na-operacao-lava-jato.html',
        'info_dict': {
            'id': 'mpf-denuncia-lula-marisa-e-mais-seis-na-operacao-lava-jato',
            'title': "Lula era o 'comandante máximo' do esquema da Lava Jato, diz MPF",
            'description': 'md5:8aa7cc8beda4dc71cc8553e00b77c54c',
        },

Review comment (suggestion):
```suggestion
    _VALID_URL = r'https?://(?!globoplay).+?\.globo\.com/(?:[^/?#]+/)*(?P<id>[^/?#.]+)(?:\.html)?'
```

Code after:

        # 4k streams are exclusively outputted in dash, so we need to filter these out
        if determine_ext(main_source['url']) == 'mpd':
            formats, subtitles = self._extract_mpd_formats_and_subtitles(main_source['url'], video_id, mpd_id='dash')
        else:
            formats, subtitles = self._extract_m3u8_formats_and_subtitles(
                main_source['url'], video_id, 'mp4', m3u8_id='hls')
        self._merge_subtitles(traverse_obj(main_source, ('text', ..., {
            'url': ('subtitle', 'srt', 'url', {url_or_none}),
        }, all, {subs_list_to_dict(lang='en')})), target=subtitles)

        return {
            'id': video_id,
            **traverse_obj(info, {
                'title': ('headline', {str}),
                'duration': ('duration', {float_or_none(scale=1000)}),
                'uploader': ('title', 'headline', {str}),
                'uploader_id': ('title', 'originProgramId', {str_or_none}),
                'episode_number': ('relatedEpisodeNumber', {int_or_none}),
                'season_number': ('relatedSeasonNumber', {int_or_none}),
            }),
            'formats': formats,
            'subtitles': subtitles,
        }


class GloboArticleIE(InfoExtractor):
    _VALID_URL = r'https?://(?!globoplay).+?\.globo\.com/(?:[^/?#]+/)*(?P<id>[^/?#.]+)(?:\.html)?'

    _VIDEOID_REGEXES = [
        r'\bdata-video-id=["\'](\d{7,})["\']',
        r'\bdata-player-videosids=["\'](\d{7,})["\']',
        r'\bvideosIDs\s*:\s*["\']?(\d{7,})',
        r'\bdata-id=["\'](\d{7,})["\']',
        r'<div[^>]+\bid=["\'](\d{7,})["\']',
        r'<bs-player[^>]+\bvideoid=["\'](\d{8,})["\']',
    ]

    _TESTS = [{
        'url': 'http://g1.globo.com/jornal-nacional/noticia/2014/09/novidade-na-fiscalizacao-de-bagagem-pela-receita-provoca-discussoes.html',
        'info_dict': {
            'id': 'novidade-na-fiscalizacao-de-bagagem-pela-receita-provoca-discussoes',
            'title': 'Novidade na fiscalização de bagagem pela Receita provoca discussões',
            'description': 'md5:c3c4b4d4c30c32fce460040b1ac46b12',
        },
        'playlist_count': 1,
    }, {
        'url': 'http://g1.globo.com/pr/parana/noticia/2016/09/mpf-denuncia-lula-marisa-e-mais-seis-na-operacao-lava-jato.html',
        'info_dict': {
            'id': 'mpf-denuncia-lula-marisa-e-mais-seis-na-operacao-lava-jato',
            'title': "Lula era o 'comandante máximo' do esquema da Lava Jato, diz MPF",