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

Code before:
        formats = []
        video = self._download_json(
            'https://playback.video.globo.com/v4/video-session', video_id,
            f'Downloading resource info for {video_id}',
            headers={'Content-Type': 'application/json'},
            data=json.dumps({
                'player_type': 'mirakulo_8k_hdr',
                'video_id': video_id,
                'quality': 'max',
                'content_protection': 'widevine',
                'vsid': f'{uuid.uuid4()}',
                'consumption': 'streaming',
                'capabilities': {'low_latency': True},
                'tz': '-03:00',
                'Authorization': try_get(self._get_cookies('https://globo.com'),
                                         lambda x: f'Bearer {x["GLBID"].value}') or '',
                'version': 1,
            }).encode())

        if traverse_obj(video, ('resource', 'drm_protection_enabled', {bool})):
            self.report_drm(video_id)

        main_source = video['sources'][0]

        # 4k streams are exclusively outputted in dash, so we need to filter these out
        if main_source['url'].endswith('mpd'):
            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):

Review comment (suggestion):
```suggestion
        if determine_ext(main_source['url']) == 'mpd':
```

Code after:
                'x-client-version': '2024.12-5',
            })['data']['video']

        formats = []
        video = self._download_json(
            'https://playback.video.globo.com/v4/video-session', video_id,
            f'Downloading resource info for {video_id}',
            headers={'Content-Type': 'application/json'},
            data=json.dumps(filter_dict({
                'player_type': 'mirakulo_8k_hdr',
                'video_id': video_id,
                'quality': 'max',
                'content_protection': 'widevine',
                'vsid': f'{uuid.uuid4()}',
                'consumption': 'streaming',
                'capabilities': {'low_latency': True},
                'tz': '-03:00',
                'Authorization': try_get(self._get_cookies('https://globo.com'),
                                         lambda x: f'Bearer {x["GLBID"].value}'),
                'version': 1,
            })).encode())

        if traverse_obj(video, ('resource', 'drm_protection_enabled', {bool})):
            self.report_drm(video_id)

        main_source = video['sources'][0]

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