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

Code before:
        if 'edu' in url:
            request_url = f'https://api.medici.tv/edu-satie/edito/movie-file/{video_id}/'
            source_url = 'https://edu.medici.tv'
        else:
            request_url = f'https://api.medici.tv/satie/edito/movie-file/{video_id}/'
            source_url = 'https://www.medici.tv'

        mAuth_cookie = cookies.get('auth._token.mAuth')
        if not mAuth_cookie:
            token = ''
        else:
            token = unquote(str_or_none(mAuth_cookie.value, ''))

        data = self._download_json(
            request_url, video_id,
            headers={
                'Authorization': token,
                'Device-Type': 'web',
                'Origin': source_url,
                'Referer': source_url + '/',
                'Accept': 'application/json, text/plain, */*',
                'Accept-Language': 'en',
            }
        )

        id = str_or_none(data.get('id'))
        title = data.get('title')
        description = data.get('subtitle')
        is_free = bool_or_none(data.get('is_free'))
        is_full = traverse_obj(data, ('video', 'is_full_video'), expected_type=bool)
        m3u8_url = traverse_obj(data, ('video', 'video_url'), expected_type=str)

        if not is_full:
            if is_free:
                self.report_warning('You need an account. Only previews will be downloaded. If you have used the --cookies-from-browser option, try using the --cookies option.')
            else:
                self.report_warning('The full video is for subscribers only. Only previews will be downloaded. If you have used the --cookies-from-browser option, try using the --cookies option.')

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

        thumbnail = data.get('picture')
        upload_date = unified_strdate(data.get('date_publish'))

        return {
            'id': id,
            'title': title,
            'description': description,
            'thumbnail': thumbnail,
            'upload_date': upload_date,
            'formats': formats,
            'subtitles': subtitles,

Review comment (suggestion):
use a diff var name; avoid redefining built-ins like `id`. IMO I would use `display_id` for the slug matched from the URL and use `video_id` for this var



Code after:
    }]

    def _real_extract(self, url):
        display_id, subdomain = self._match_valid_url(url).group('id', 'sub')
        self._request_webpage(url, display_id, 'Requesting CSRF token cookie')

        subdomain = 'edu-' if subdomain == 'edu' else ''
        origin = f'https://{urllib.parse.urlparse(url).hostname}'

        data = self._download_json(
            f'https://api.medici.tv/{subdomain}satie/edito/movie-file/{display_id}/', display_id,
            headers=filter_dict({
                'Authorization': try_call(
                    lambda: urllib.parse.unquote(self._get_cookies(url)['auth._token.mAuth'].value)),
                'Device-Type': 'web',
                'Origin': origin,
                'Referer': f'{origin}/',
                'Accept': 'application/json, text/plain, */*',
            }))

        if not traverse_obj(data, ('video', 'is_full_video')) and traverse_obj(
                data, ('video', 'is_limited_by_user_access')):
            self.report_warning(
                'The full video is for subscribers only. Only previews will be downloaded. If you '
                'have used the --cookies-from-browser option, try using the --cookies option instead')

        formats, subtitles = self._extract_m3u8_formats_and_subtitles(
            data['video']['video_url'], display_id, 'mp4')

        return {
            'id': str(data['id']),
            'display_id': display_id,
            'formats': formats,
            'subtitles': subtitles,
            **traverse_obj(data, {
                'title': ('title', {str}),
                'description': ('subtitle', {str}),
                'thumbnail': ('picture', {url_or_none}),
                'timestamp': ('date_publish', {parse_iso8601}),
            }),
        }