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

Code before:
                        'format_id': quality,
                        'quality': q(quality),
                        'url': video_url,
                    })
        return formats, subtitles

    def _parse_metadata(self, metadata):
        return traverse_obj(metadata, {
            'title': ('title', {str.strip}),
            'alt_title': ('alt', {str.strip}),
            'description': ('description', {clean_html}),
            'timestamp': ('dateOfEmission', {parse_iso8601(delimiter=' ')}),
            'release_timestamp': ('publicationDate', {parse_iso8601(delimiter=' ')}),
            'modified_timestamp': ('modificationDate', {parse_iso8601(delimiter=' ')}),
            'thumbnail': (('thumbnail', 'image', 'imageSEO'), {url_or_none}, any),
            'duration': ('duration', {float_or_none(scale=1000)}),
            'is_live': ('live', {bool}),
            'series': (('programTitle', ('programInfo', 'title')), {clean_html}, any),
        })


class RTVEALaCartaIE(RTVEBaseIE):
    IE_NAME = 'rtve.es:alacarta'
    IE_DESC = 'RTVE a la carta and Play'
    _VALID_URL = [
        r'https?://(?:www\.)?rtve\.es/(m/)?(?:(?:alacarta|play)/videos|filmoteca)/[^/?#]+/[^/?#]+/(?P<id>\d+)',
        r'https?://(?:www\.)?rtve\.es/infantil/serie/[^/?#]+/video/[^/?#]+/(?P<id>\d+)',
    ]

    _TESTS = [{
        'url': 'http://www.rtve.es/alacarta/videos/la-aventura-del-saber/aventuraentornosilla/3088905/',
        'md5': 'a964547824359a5753aef09d79fe984b',
        'info_dict': {
            'id': '3088905',
            'ext': 'mp4',
            'title': 'En torno a la silla',
            'duration': 1216.981,
            'series': 'La aventura del Saber',
            'thumbnail': 'https://img2.rtve.es/v/aventuraentornosilla_3088905.png',
        },
    }, {
        'note': 'Live stream',
        'url': 'http://www.rtve.es/alacarta/videos/television/24h-live/1694255/',
        'info_dict': {
            'id': '1694255',
            'ext': 'mp4',
            'title': 're:^24H LIVE [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
            'is_live': True,
            'live_status': 'is_live',
            'thumbnail': r're:https://img2\.rtve\.es/v/.*\.png',
        },

Review comment (suggestion):
```suggestion
        r'https?://(?:www\.)?rtve\.es/(?:m/)?(?:(?:alacarta|play)/videos|filmoteca)/(?:[^/?#]+/){2}(?P<id>\d+)',
```

Code after:
                    formats.append({
                        'format_id': quality,
                        'quality': q(quality),
                        'url': video_url,
                    })
        return formats, subtitles

    def _parse_metadata(self, metadata):
        return traverse_obj(metadata, {
            'title': ('title', {str.strip}),
            'alt_title': ('alt', {str.strip}),
            'description': ('description', {clean_html}),
            'timestamp': ('dateOfEmission', {parse_iso8601(delimiter=' ')}),
            'release_timestamp': ('publicationDate', {parse_iso8601(delimiter=' ')}),
            'modified_timestamp': ('modificationDate', {parse_iso8601(delimiter=' ')}),
            'thumbnail': (('thumbnail', 'image', 'imageSEO'), {url_or_none}, any),
            'duration': ('duration', {float_or_none(scale=1000)}),
            'is_live': ('live', {bool}),
            'series': (('programTitle', ('programInfo', 'title')), {clean_html}, any),
        })


class RTVEALaCartaIE(RTVEBaseIE):
    IE_NAME = 'rtve.es:alacarta'
    IE_DESC = 'RTVE a la carta and Play'
    _VALID_URL = [
        r'https?://(?:www\.)?rtve\.es/(?:m/)?(?:(?:alacarta|play)/videos|filmoteca)/(?!directo)(?:[^/?#]+/){2}(?P<id>\d+)',
        r'https?://(?:www\.)?rtve\.es/infantil/serie/[^/?#]+/video/[^/?#]+/(?P<id>\d+)',
    ]

    _TESTS = [{
        'url': 'http://www.rtve.es/alacarta/videos/la-aventura-del-saber/aventuraentornosilla/3088905/',
        'md5': 'a964547824359a5753aef09d79fe984b',
        'info_dict': {
            'id': '3088905',
            'ext': 'mp4',
            'title': 'En torno a la silla',
            'duration': 1216.981,
            'series': 'La aventura del Saber',
            'thumbnail': 'https://img2.rtve.es/v/aventuraentornosilla_3088905.png',
        },
    }, {
        'note': 'Live stream',
        'url': 'http://www.rtve.es/alacarta/videos/television/24h-live/1694255/',
        'info_dict': {
            'id': '1694255',
            'ext': 'mp4',
            'title': 're:^24H LIVE [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}$',
            'is_live': True,
            'live_status': 'is_live',
            'thumbnail': r're:https://img2\.rtve\.es/v/.*\.png',