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

Code before:
        }
    }, {
        'url': 'https://www.freetv.com/peliculas/monstruoso/',
        'md5': '509c15c68de41cb708d1f92d071f20aa',
        'info_dict': {
            'id': '377652',
            'title': 'Monstruoso',
            'description': 'md5:333fc19ee327b457b980e54a911ea4a3',
            'ext': 'mp4',
        }
    }]

    def _real_extract(self, url):
        display_id = self._match_id(url)
        webpage = self._download_webpage(url, display_id)

        content_id = self._search_regex(
            (r'class=["\'][^>]+postid-(?P<video_id>\d+)',
             r'<link[^>]+freetv.com/\?p=(?P<video_id>\d+)'
             r'<div[^>]+data-params=["\'][^>]+post_id=(?P<video_id>\d+)'),
            webpage, 'video_id', group='video_id')

        return self._extract_video(content_id)


class FreeTvSeriesIE(FreeTvBaseIE):
    _VALID_URL = r'https?://(?:www\.)?freetv\.com/(?:series)/(?:[^/]+/)*(?P<id>[^/]+)'
    _TESTS = [{
        'url': 'https://www.freetv.com/series/el-detective-l/',
        'info_dict': {
            'id': 'el-detective-l',
            'title': 'El Detective L',
            'description': 'md5:f9f1143bc33e9856ecbfcbfb97a759be'
        },
        'playlist_count': 24,
    }, {
        'url': 'https://www.freetv.com/series/esmeraldas/',
        'info_dict': {
            'id': 'esmeraldas',
            'title': 'Esmeraldas',
            'description': 'md5:43d7ec45bd931d8268a4f5afaf4c77bf'
        },
        'playlist_count': 62,
    }, {
        'url': 'https://www.freetv.com/series/las-aventuras-de-leonardo/',
        'info_dict': {
            'id': 'las-aventuras-de-leonardo',
            'title': 'Las Aventuras de Leonardo',
            'description': 'md5:0c47130846c141120a382aca059288f6'
        },
        'playlist_count': 13,

Review comment (suggestion):
In case we want to seperate the IE into single episode/series later, naming this FreeTvIE would provide some future-proofing. You can set an IE_NAME explaining it's series
```suggestion
class FreeTvIE(FreeTvBaseIE):
    IE_NAME = 'freetv:series'
```

Code after:

        for episode in episodes:
            video_id = str(episode['contentID'])
            formats, subtitles = self._extract_m3u8_formats_and_subtitles(episode['streamURL'], video_id, 'mp4')
            self._sort_formats(formats)

            yield {
                'id': video_id,
                'title': episode.get('fullTitle'),
                'description': episode.get('description'),
                'formats': formats,
                'subtitles': subtitles,
                'thumbnail': episode.get('thumbnail'),
                'series': series_title,
                'series_id': traverse_obj(episode, ('contentMeta', 'displayMeta', 'seriesID')),
                'season_id': traverse_obj(episode, ('contentMeta', 'displayMeta', 'seasonID')),
                'season_number': traverse_obj(
                    episode, ('contentMeta', 'displayMeta', 'seasonNum'), expected_type=int_or_none),
                'episode_number': traverse_obj(
                    episode, ('contentMeta', 'displayMeta', 'episodeNum'), expected_type=int_or_none),
            }

    def _real_extract(self, url):
        display_id = self._match_id(url)
        webpage = self._download_webpage(url, display_id)

        title = self._html_search_regex(
            r'<h1[^>]+class=["\']synopis[^>]>(?P<title>[^<]+)', webpage, 'title', group='title', fatal=False)
        description = self._html_search_regex(
            r'<div[^>]+class=["\']+synopis content[^>]><p>(?P<description>[^<]+)',
            webpage, 'description', group='description', fatal=False)

        return self.playlist_result(
            itertools.chain.from_iterable(
                self._extract_series_season(season_id, title)
                for season_id in re.findall(r'<option[^>]+value=["\'](\d+)["\']', webpage)),
            display_id, title, description)