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

Code before:
            f'https://api2.rtve.es/api/videos/{video_id}/subtitulos.json', video_id,
            'Downloading subtitles info')
        return traverse_obj(subtitle_data, ('page', 'items', ..., {
            'id': ('lang', {str}),
            'url': ('src', {url_or_none}),
        }, all, {subs_list_to_dict(lang='es')}))

    def _real_extract(self, url):
        video_id = self._match_id(url)
        metadata = self._download_json(
            f'http://www.rtve.es/api/videos/{video_id}/config/alacarta_videos.json',
            video_id)['page']['items'][0]
        if metadata['state'] == 'DESPU':
            raise ExtractorError('The video is no longer available', expected=True)
        formats, subtitles = self._extract_png_formats_and_subtitles(video_id)

        self._merge_subtitles(self.extract_subtitles(video_id), target=subtitles)

        is_infantil = urllib.parse.urlparse(url).path.startswith('/infantil/')

        return {
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            **self._parse_metadata(metadata),
            '_old_archive_ids': [f'rtveinfantil {video_id}'] if is_infantil else None,
        }


class RTVEAudioIE(RTVEBaseIE):
    IE_NAME = 'rtve.es:audio'
    IE_DESC = 'RTVE audio'
    _VALID_URL = r'https?://(?:www\.)?rtve\.es/(alacarta|play)/audios/[^/?#]+/[^/?#]+/(?P<id>\d+)'

    _TESTS = [{
        'url': 'https://www.rtve.es/alacarta/audios/a-hombros-de-gigantes/palabra-ingeniero-codigos-informaticos-27-04-21/5889192/',
        'md5': 'ae06d27bff945c4e87a50f89f6ce48ce',
        'info_dict': {
            'id': '5889192',
            'ext': 'mp3',
            'title': 'Códigos informáticos',
            'alt_title': 'Códigos informáticos - Escuchar ahora',
            'duration': 349.440,
            'series': 'A hombros de gigantes',
            'description': 'md5:72b0d7c1ca20fd327bdfff7ac0171afb',
            'thumbnail': 'https://img2.rtve.es/a/palabra-ingeniero-codigos-informaticos-270421_5889192.png',
        },
    }, {
        'url': 'https://www.rtve.es/play/audios/en-radio-3/ignatius-farray/5791165/',
        'md5': '072855ab89a9450e0ba314c717fa5ebc',
        'info_dict': {

Review comment (suggestion):
```suggestion
            '_old_archive_ids': [make_archive_id('rtveinfantil', video_id)] if is_infantil else None,
```

Code after:
        subtitle_data = self._download_json(
            f'https://api2.rtve.es/api/videos/{video_id}/subtitulos.json', video_id,
            'Downloading subtitles info')
        return traverse_obj(subtitle_data, ('page', 'items', ..., {
            'id': ('lang', {str}),
            'url': ('src', {url_or_none}),
        }, all, {subs_list_to_dict(lang='es')}))

    def _real_extract(self, url):
        video_id = self._match_id(url)
        metadata = self._download_json(
            f'http://www.rtve.es/api/videos/{video_id}/config/alacarta_videos.json',
            video_id)['page']['items'][0]
        if metadata['state'] == 'DESPU':
            raise ExtractorError('The video is no longer available', expected=True)
        formats, subtitles = self._extract_png_formats_and_subtitles(video_id)

        self._merge_subtitles(self.extract_subtitles(video_id), target=subtitles)

        is_infantil = urllib.parse.urlparse(url).path.startswith('/infantil/')

        return {
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            **self._parse_metadata(metadata),
            '_old_archive_ids': [make_archive_id('rtveinfantil', video_id)] if is_infantil else None,
        }


class RTVEAudioIE(RTVEBaseIE):
    IE_NAME = 'rtve.es:audio'
    IE_DESC = 'RTVE audio'
    _VALID_URL = r'https?://(?:www\.)?rtve\.es/(alacarta|play)/audios/(?:[^/?#]+/){2}(?P<id>\d+)'

    _TESTS = [{
        'url': 'https://www.rtve.es/alacarta/audios/a-hombros-de-gigantes/palabra-ingeniero-codigos-informaticos-27-04-21/5889192/',
        'md5': 'ae06d27bff945c4e87a50f89f6ce48ce',
        'info_dict': {
            'id': '5889192',
            'ext': 'mp3',
            'title': 'Códigos informáticos',
            'alt_title': 'Códigos informáticos - Escuchar ahora',
            'duration': 349.440,
            'series': 'A hombros de gigantes',
            'description': 'md5:72b0d7c1ca20fd327bdfff7ac0171afb',
            'thumbnail': 'https://img2.rtve.es/a/palabra-ingeniero-codigos-informaticos-270421_5889192.png',
        },
    }, {
        'url': 'https://www.rtve.es/play/audios/en-radio-3/ignatius-farray/5791165/',
        'md5': '072855ab89a9450e0ba314c717fa5ebc',