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

Code before:
                rf'src="https?://{host}/media/embed.*(?:\?|&)key=([0-9a-f]+)&?',
                webpage, 'video_id')

        # Title, description from page meta wouldn't be correct if the video is embedded
        # so separating normal and embedded extraction
        if not (display_id or tmp_id):
            title = self._html_search_regex(r'<img[^>]*title="([^"<]+)"', webpage, 'title', fatal=False)
            description = None
        else:
            title = self._html_search_meta(('og:title', 'twitter:title', 'title'), webpage, default=None)
            description = self._html_search_meta(('og:description', 'twitter:description', 'description'), webpage, default=None)

        # Many pages don't provide HLSs but some do, so ignoring 404s
        formats = []
        subtitles = {}
        try:
            formats, subtitles = self._extract_m3u8_formats_and_subtitles(
                f'https://{host}/media/hlsMedium/key/{video_id}/format/auto/ext/mp4/learning/0/path/m3u8',
                video_id, 'mp4', 'm3u8_native', m3u8_id='hls', fatal=True)
        except ExtractorError as e:
            if isinstance(e.cause, compat_HTTPError) and e.cause.code == 404:
                pass
            else:
                raise

        formats.append({'url': f'https://{host}/getMedium/{video_id}.mp4', 'ext': 'mp4'})
        self._sort_formats(formats)

        return {
            'id': video_id,
            'title': title,
            'description': description,
            'display_id': display_id,
            'formats': formats,
            'subtitles': subtitles
        }


Review comment (bug):
is this better than other formats? Since no metadata is available, yt-dlp will assume it's the worst format by default. You can set a `'quality': 1` to tell yt-dlp that the format is better than others. (Ignore this if my assumption is wrong)

btw, u don't need to set ext=mp4. yt-dlp will see the URL and determine it automagically

Code after:
            },
        },
        {
            'url': 'https://videocampus.sachsen.de/media/embed?key=fc99c527e4205b121cb7c74433469262',
            'info_dict': {
                'id': 'fc99c527e4205b121cb7c74433469262',
                'title': 'Was ist selbstgesteuertes Lernen?',
                'ext': 'mp4',
            },
        }
    ]

    def _real_extract(self, url):
        host, video_id, tmp_id, display_id, embed_id = self._match_valid_url(url).group(
            'host', 'id', 'tmp_id', 'display_id', 'embed_id')
        webpage = self._download_webpage(url, video_id or tmp_id, fatal=False) or ''

        if not video_id:
            video_id = embed_id or self._html_search_regex(
                rf'src="https?://{host}/media/embed.*(?:\?|&)key=([0-9a-f]+)&?',
                webpage, 'video_id')

        if not (display_id or tmp_id):
            # Title, description from embedded page's meta wouldn't be correct
            title = self._html_search_regex(r'<img[^>]* title="([^"<]+)"', webpage, 'title', fatal=False)
            description = None
        else:
            title = self._html_search_meta(('og:title', 'twitter:title', 'title'), webpage, fatal=False)
            description = self._html_search_meta(
                ('og:description', 'twitter:description', 'description'), webpage, default=None)

        formats, subtitles = [], {}
        try:
            formats, subtitles = self._extract_m3u8_formats_and_subtitles(
                f'https://{host}/media/hlsMedium/key/{video_id}/format/auto/ext/mp4/learning/0/path/m3u8',
                video_id, 'mp4', m3u8_id='hls', fatal=True)
        except ExtractorError as e:
            if not isinstance(e.cause, compat_HTTPError) or e.cause.code not in (404, 500):
                raise

        formats.append({'url': f'https://{host}/getMedium/{video_id}.mp4'})
        self._sort_formats(formats)

        return {
            'id': video_id,
            'title': title,
            'description': description,
            'display_id': display_id,
            'formats': formats,
            'subtitles': subtitles
        }