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

Code before:
        'md5': '26df7fdcf859f38ad92d837279d6b56d',
        'info_dict': {
            'id': '296152',
            'title': 'Pulso activo | 18-11-2025',
            'description': 'Anxo, Noemí, Silvia e Estrella  comparten as sensacións da clase de Eddy.',
            'thumbnail': 'https://crtvg-bucket.flumotion.cloud/content_cards/a6bb7da6c8994b82bf961ac6cad1707b.png',
            'ext': 'mp4',
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        info_url = f'https://api-agalega.interactvty.com/api/2.0/contents/content/{video_id}/?optional_fields=image,is_premium,short_description,has_subtitle'
        media_url = f'https://api-agalega.interactvty.com/api/2.0/contents/content_resources/{video_id}/?optional_fields=media_url'
        auth_header = self._get_access_token(video_id)

        if auth_header is not None:
            info_raw = self._download_json(info_url, video_id, headers=auth_header)
            media_raw = self._download_json(media_url, video_id, headers=auth_header)

            if info_raw is not None and media_raw is not None:
                m3u8_url = traverse_obj(media_raw, ('results', ..., 'media_url', {url_or_none}, any, {require('media_url')}))
                formats = self._extract_m3u8_formats_and_subtitles(
                    m3u8_url, video_id, ext='mp4',
                    m3u8_id='hls', entry_protocol='m3u8_native', fatal=False,
                )
                return {
                    'id': traverse_obj(info_raw, ('id', {int}, {str_or_none}, {require('id')})),
                    'formats': formats[0],
                    **traverse_obj(info_raw, {
                        'title': ('name', {str_or_none}),
                        'description': (('description', 'short_description'), {str_or_none}, any),
                        'thumbnail': ('image', {url_or_none}),
                    }),
                }
            else:
                return None
        return None


class AGalegaSeriesIE(AGalegaBaseIE):
    IE_NAME = 'agalega:series'
    _VALID_URL = r'https?://(?:www\.)?agalega\.gal/videos/category/(?P<id>[0-9]+)'
    _TESTS = [{
        'url': 'https://www.agalega.gal/videos/category/27035-galician-friki',
        'info_dict': {
            'id': '27035',
            'title': 'Galician Friki',
            'description': 'md5:68279845eea70ba3b4324bd96e3aac30',
            'thumbnail': 'https://crtvg-bucket.flumotion.cloud/category_cards/f1d4e23fa336467ba9b1330f6224c589.jpg',
        },

Review comment (refactor):
Same here, we should also extract all possible media URLs and not silently discard subtitles.
```suggestion
        formats = []
        subtitles = {}
        for m3u8_url in traverse_obj(resource_data, ('results', ..., 'media_url', {url_or_none})):
            fmts, subs = self._extract_m3u8_formats_and_subtitles(
                m3u8_url, video_id, ext='mp4', m3u8_id='hls')
            formats.extend(fmts)
            self._merge_subtitles(subs, target=subtitles)
```

Code after:
            'id': '296152',
            'title': 'Pulso activo | 18-11-2025',
            'description': 'Anxo, Noemí, Silvia e Estrella  comparten as sensacións da clase de Eddy.',
            'thumbnail': 'https://crtvg-bucket.flumotion.cloud/content_cards/a6bb7da6c8994b82bf961ac6cad1707b.png',
            'ext': 'mp4',
        },
    }]

    def _real_extract(self, url):
        video_id = self._match_id(url)
        content_data = self._call_api(
            f'content/{video_id}/', video_id, note='Downloading content data', fatal=False,
            query={
                'optional_fields': 'image,is_premium,short_description,has_subtitle',
            })
        resource_data = self._call_api(
            f'content_resources/{video_id}/', video_id, note='Downloading resource data',
            query={
                'optional_fields': 'media_url',
            })

        formats = []
        subtitles = {}
        for m3u8_url in traverse_obj(resource_data, ('results', ..., 'media_url', {url_or_none})):
            fmts, subs = self._extract_m3u8_formats_and_subtitles(
                m3u8_url, video_id, ext='mp4', m3u8_id='hls')
            formats.extend(fmts)
            self._merge_subtitles(subs, target=subtitles)

        return {
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            **traverse_obj(content_data, {
                'title': ('name', {str}),
                'description': (('description', 'short_description'), {str}, any),
                'thumbnail': ('image', {url_or_none}),
            }),
        }