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

Code before:
            if not seasons:
                podcast_episodes = traverse_obj(hydration, ('content', 'currentContent', 'audios'))
                if not podcast_episodes:
                    raise ExtractorError('Could not find asset_id nor program playlist nor podcast episodes')

                return self.playlist_result([self.url_result(episode['file'], **traverse_obj(episode, {
                    'title': 'title',
                    'description': 'description',
                    'episode_number': ('chapter_number', {lambda x: int_or_none(float_or_none(x))}),
                    'season_number': 'season',
                })) for episode in podcast_episodes], video_id, **metadata)

            entries = []
            for season in seasons:
                for episode in season['contents']:
                    entries.append(self.url_result(urljoin(url, episode['slug']), **{
                        **traverse_obj(season, {
                            'season': 'title',
                            'season_number': 'season',
                        }),
                        **traverse_obj(episode, {
                            'title': 'title',
                            'thumbnail': ('image', 'cover', 'path'),
                            'episode_number': 'chapter_number',
                        })
                    }))

            return self.playlist_result(entries, video_id, **metadata)

        formats, subtitles = self._extract_m3u8_formats_and_subtitles(hls_url, video_id, 'mp4')

        return {
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            'is_live': category == 'en-vivo',
            **metadata,
        }


class RTVCPlayEmbedIE(RTFVPlayBaseIE):
    _VALID_URL = RTFVPlayBaseIE._BASE_VALID_URL + r'/embed/(?P<id>[\w-]+)'

    _TESTS = [{
        'url': 'https://www.rtvcplay.co/embed/72b0e699-248b-4929-a4a8-3782702fa7f9',
        'md5': 'ed529aeaee7aa2a72afe91ac7d1177a8',
        'info_dict': {
            'id': '72b0e699-248b-4929-a4a8-3782702fa7f9',
            'title': 'Tráiler: Señoritas',
            'thumbnail': r're:^https?://.*\.(?:jpg|png)',
            'ext': 'mp4',

Review comment (suggestion):
intermediate dict is not necessary
```suggestion
            entries = []
            for season in seasons:
                for episode in traverse_obj(season, ('contents', ...)):
                    entries.append(self.url_result(
                        urljoin(url, episode['slug']), url_transparent=True,
                        **traverse_obj(season, {
                            'season': 'title',
                            'season_number': ('season', {int_or_none}),
                        }),
                        **traverse_obj(episode, {
                            'title': 'title',
                            'thumbnail': ('image', 'cover', 'path'),
                            'episode_number': ('chapter_number', {int_or_none}),
                        })))
```
or
```suggestion
            entries = [
                self.url_result(
                    urljoin(url, episode['slug']), url_transparent=True,
                    **traverse_obj(season, {
                        'season': 'title',
                        'season_number': ('season', {int_or_none}),
                    }),
                    **traverse_obj(episode, {
                        'title': 'title',
                        'thumbnail': ('image', 'cover', 'path'),
                        'episode_number': ('chapter_number', {int_or_none}),
                    }))
                for season in seasons
                for episode in traverse_obj(season, ('contents', ...))
            ]
```

Code after:
                hydration, ('widgets', lambda _, y: y['type'] == 'seasonList', 'contents'),
                get_all=False)
            if not seasons:
                podcast_episodes = hydration.get('audios')
                if not podcast_episodes:
                    raise ExtractorError('Could not find asset_id nor program playlist nor podcast episodes')

                return self.playlist_result([
                    self.url_result(episode['file'], url_transparent=True, **traverse_obj(episode, {
                        'title': 'title',
                        'description': ('description', {clean_html}),
                        'episode_number': ('chapter_number', {float_or_none}, {int_or_none}),
                        'season_number': ('season', {int_or_none}),
                    })) for episode in podcast_episodes], video_id, **metadata)

            entries = [self.url_result(
                urljoin(url, episode['slug']), url_transparent=True,
                **traverse_obj(season, {
                    'season': 'title',
                    'season_number': ('season', {int_or_none}),
                }), **traverse_obj(episode, {
                    'title': 'title',
                    'thumbnail': ('image', 'cover', 'path'),
                    'episode_number': ('chapter_number', {int_or_none}),
                })) for season in seasons for episode in traverse_obj(season, ('contents', ...))]

            return self.playlist_result(entries, video_id, **metadata)

        formats, subtitles = self._extract_m3u8_formats_and_subtitles(hls_url, video_id, 'mp4')

        return {
            'id': video_id,
            'formats': formats,
            'subtitles': subtitles,
            'is_live': category == 'en-vivo',
            **metadata,
        }


class RTVCPlayEmbedIE(RTVCPlayBaseIE):
    _VALID_URL = RTVCPlayBaseIE._BASE_VALID_URL + r'/embed/(?P<id>[\w-]+)'

    _TESTS = [{
        'url': 'https://www.rtvcplay.co/embed/72b0e699-248b-4929-a4a8-3782702fa7f9',
        'md5': 'ed529aeaee7aa2a72afe91ac7d1177a8',
        'info_dict': {
            'id': '72b0e699-248b-4929-a4a8-3782702fa7f9',
            'title': 'Tráiler: Señoritas',
            'thumbnail': r're:^https?://.*\.(?:jpg|png)',
            'ext': 'mp4',
        }