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

Code before:
    }, {
        'url': 'https://www.rtvcplay.co/series-al-oido/relato-de-un-naufrago-una-travesia-del-periodismo-a-la-literatura',
        'info_dict': {
            'id': 'relato-de-un-naufrago-una-travesia-del-periodismo-a-la-literatura',
            'title': 'Relato de un náufrago: una travesía del periodismo a la literatura',
            'description': 'md5:6da28fdca4a5a568ea47ef65ef775603',
            'thumbnail': r're:^https?://.*\.(?:jpg|png)',
        },
        'playlist_mincount': 5,
    }, {
        'url': 'https://www.rtvcplay.co/series-al-oido/diez-versiones',
        'info_dict': {
            'id': 'diez-versiones',
            'title': 'Diez versiones',
            'description': 'md5:997471ed971cb3fd8e41969457675306',
            'thumbnail': r're:^https?://.*\.(?:jpg|png)',
        },
        'playlist_mincount': 20,
    }]

    def _real_extract(self, url):
        video_id, category = self._match_valid_url(url).group('id', 'category')
        webpage = self._download_webpage(url, video_id)

        hydration = self._search_json(
            r'window.__RTVCPLAY_STATE__\s*=', webpage, 'hydration', video_id, transform_source=js_to_json)

        asset_id = traverse_obj(hydration, ('content', 'currentContent', 'video', 'assetid'))
        if asset_id:
            hls_url = hydration['content']['currentContent']['base_url_hls'].replace('[node:field_asset_id]', asset_id)
        else:
            hls_url = traverse_obj(hydration, ('content', 'currentContent', 'channel', 'hls'))

        metadata = {
            'thumbnail': traverse_obj(
                hydration, ('content', 'currentContent', 'channel', 'image', 'logo', 'path'),
                ('content', 'currentContent', 'resource', 'image', 'cover_desktop', 'path')),
            **traverse_obj(hydration, ('content', 'currentContent', {
                'title': 'title',
                'description': 'description',
            })),
        }

        # Probably it's a program's page
        if not hls_url:
            seasons = traverse_obj(
                hydration, ('content', 'currentContent', 'widgets', lambda _, y: y['type'] == 'seasonList', 'contents'),
                get_all=False)
            if not seasons:
                podcast_episodes = traverse_obj(hydration, ('content', 'currentContent', 'audios'))
                if not podcast_episodes:

Review comment (suggestion):
```suggestion
            r'window\.__RTVCPLAY_STATE__\s*=', webpage, 'hydration', video_id, transform_source=js_to_json)
```
.
or, since it looks like we don't traverse outside of `currentContent`, we could do this:
```suggestion
            r'window\.__RTVCPLAY_STATE__\s*=', webpage, 'hydration', video_id, transform_source=js_to_json)['content']['currentContent']
```
though that would mean we have to adjust every other traversal of `hydration` in this method

Code after:
            'title': 'Profe en tu casa',
            'description': 'md5:47dbe20e263194413b1db2a2805a4f2e',
            'thumbnail': r're:^https?://.*\.(?:jpg|png)',
        },
        'playlist_mincount': 537,
    }, {
        'url': 'https://www.rtvcplay.co/series-al-oido/relato-de-un-naufrago-una-travesia-del-periodismo-a-la-literatura',
        'info_dict': {
            'id': 'relato-de-un-naufrago-una-travesia-del-periodismo-a-la-literatura',
            'title': 'Relato de un náufrago: una travesía del periodismo a la literatura',
            'description': 'md5:6da28fdca4a5a568ea47ef65ef775603',
            'thumbnail': r're:^https?://.*\.(?:jpg|png)',
        },
        'playlist_mincount': 5,
    }, {
        'url': 'https://www.rtvcplay.co/series-al-oido/diez-versiones',
        'info_dict': {
            'id': 'diez-versiones',
            'title': 'Diez versiones',
            'description': 'md5:997471ed971cb3fd8e41969457675306',
            'thumbnail': r're:^https?://.*\.(?:jpg|png)',
        },
        'playlist_mincount': 20,
    }]

    def _real_extract(self, url):
        video_id, category = self._match_valid_url(url).group('id', 'category')
        webpage = self._download_webpage(url, video_id)

        hydration = self._search_json(
            r'window\.__RTVCPLAY_STATE__\s*=', webpage, 'hydration',
            video_id, transform_source=js_to_json)['content']['currentContent']

        asset_id = traverse_obj(hydration, ('video', 'assetid'))
        if asset_id:
            hls_url = hydration['base_url_hls'].replace('[node:field_asset_id]', asset_id)
        else:
            hls_url = traverse_obj(hydration, ('channel', 'hls'))

        metadata = traverse_obj(hydration, {
            'title': 'title',
            'description': 'description',
            'thumbnail': ((('channel', 'image', 'logo'), ('resource', 'image', 'cover_desktop')), 'path'),
        }, get_all=False)

        # Probably it's a program's page
        if not hls_url:
            seasons = traverse_obj(
                hydration, ('widgets', lambda _, y: y['type'] == 'seasonList', 'contents'),
                get_all=False)
            if not seasons: