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

Code before:
            if video:
                videos.append(video)
                if duration is None:
                    duration = video.get('duration')
                if is_live is None:
                    is_live = video.get('is_live')
                if spritesheets is None:
                    spritesheets = video.get('spritesheets')

            meta = dinfo.get('meta')
            if meta:
                if title is None:
                    title = meta.get('title')
                # XXX: what is meta['pre_title']?
                if subtitle is None:
                    subtitle = meta.get('additional_title')
                if image is None:
                    image = meta.get('image_url')
                if timestamp is None:
                    timestamp = parse_iso8601(meta.get('broadcasted_at'))

        formats = []
        subtitles = {}
        for video in videos:
            format_id = video.get('format')

            video_url = None
            if video.get('workflow') == 'token-akamai':
                token_url = video.get('token')
                if token_url:
                    token_json = self._download_json(
                        token_url, video_id,
                        'Downloading signed %s manifest URL' % format_id)
                    if token_json:
                        video_url = token_json.get('url')
            if not video_url:
                video_url = video.get('url')

            ext = determine_ext(video_url)
            if ext == 'f4m':
                formats.extend(self._extract_f4m_formats(
                    video_url, video_id, f4m_id=format_id, fatal=False))
            elif ext == 'm3u8':
                fmts, subs = self._extract_m3u8_formats_and_subtitles(
                    video_url, video_id, 'mp4',
                    entry_protocol='m3u8_native', m3u8_id=format_id,
                    fatal=False)
                formats.extend(fmts)
                self._merge_subtitles(subs, target=subtitles)
            elif ext == 'mpd':
                fmts, subs = self._extract_mpd_formats_and_subtitles(

Review comment (suggestion):
I would actually match the `S<ID> E<ID>` format like so:
```suggestion
                    season_number, episode_number = self._search_regex(
                        r'S(\d+)\s*E(\d+)', meta.get('pre_title'), 'episode info', group=(1, 2), default=(None, None))
```

Code after:
            if not dinfo:
                continue

            video = dinfo.get('video')
            if video:
                videos.append(video)
                if duration is None:
                    duration = video.get('duration')
                if is_live is None:
                    is_live = video.get('is_live')
                if spritesheets is None:
                    spritesheets = video.get('spritesheets')

            meta = dinfo.get('meta')
            if meta:
                if title is None:
                    title = meta.get('title')
                # meta['pre_title'] contains season and episode number for series in format "S<ID> E<ID>"
                season_number, episode_number = self._search_regex(
                    r'S(\d+)\s*E(\d+)', meta.get('pre_title'), 'episode info', group=(1, 2), default=(None, None))
                if subtitle is None:
                    subtitle = meta.get('additional_title')
                if image is None:
                    image = meta.get('image_url')
                if timestamp is None:
                    timestamp = parse_iso8601(meta.get('broadcasted_at'))

        formats = []
        subtitles = {}
        for video in videos:
            format_id = video.get('format')

            video_url = None
            if video.get('workflow') == 'token-akamai':
                token_url = video.get('token')
                if token_url:
                    token_json = self._download_json(
                        token_url, video_id,
                        'Downloading signed %s manifest URL' % format_id)
                    if token_json:
                        video_url = token_json.get('url')
            if not video_url:
                video_url = video.get('url')

            ext = determine_ext(video_url)
            if ext == 'f4m':
                formats.extend(self._extract_f4m_formats(
                    video_url, video_id, f4m_id=format_id, fatal=False))
            elif ext == 'm3u8':
                fmts, subs = self._extract_m3u8_formats_and_subtitles(
                    video_url, video_id, 'mp4',