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

Code before:
            else:
                yield {
                    'url': format_url,
                    'ext': ext,
                    'format_id': f'http-{format_id}',
                    'quality': quality,
                    **video_properties,
                }

        raw_url = self._call_url_api('raw-url', video_id)
        formats.extend(get_formats(raw_url, 'raw', quality=1))  # original quality

        transcoded_url = self._call_url_api('transcoded-url', video_id)
        formats.extend(get_formats(transcoded_url, 'transcoded', quality=-1))  # transcoded quality

        cdn_url = traverse_obj(video_data, ('data', 'getVideo', 'nullableRawCdnUrl', 'url', {url_or_none}))
        # cdn_url is usually a dupe, but the raw-url/transcoded-url endpoints could return errors
        valid_urls = [update_url(url, query=None) for url in (raw_url, transcoded_url) if url]
        if cdn_url and update_url(cdn_url, query=None) not in valid_urls:
            formats.extend(get_formats(cdn_url, 'cdn', quality=0))  # could be original or transcoded

        return formats

    def _get_subtitles(self, video_id):
        subs_data = self._call_graphql_api(
            'FetchVideoTranscript', video_id, 'Downloading GraphQL subtitles data')
        return filter_dict({
            'en': traverse_obj(subs_data, (
                'data', 'fetchVideoTranscript',
                ('source_url', 'captions_source_url'), {
                    'url': {url_or_none},
                })) or None,
        })

    def _real_extract(self, url):
        video_id = self._match_id(url)
        metadata = traverse_obj(
            self._call_graphql_api('GetVideoSSR', video_id, 'Downloading GraphQL metadata JSON', fatal=False),
            ('data', 'getVideo', {dict})) or {}

        if metadata.get('__typename') == 'VideoPasswordMissingOrIncorrect':
            if not self.get_param('videopassword'):
                raise ExtractorError(
                    'This video is password-protected, use the --video-password option', expected=True)
            raise ExtractorError('Invalid video password', expected=True)

        video_data = self._call_graphql_api(
            'GetVideoSource', video_id, 'Downloading GraphQL video JSON')
        chapter_data = self._call_graphql_api(
            'FetchChapters', video_id, 'Downloading GraphQL chapters JSON', fatal=False)
        duration = traverse_obj(metadata, ('video_properties', 'duration', {int_or_none}))

Review comment (suggestion):
```suggestion
    def _get_subtitles(self, video_id):
        subs_data = self._call_graphql_api(
            'FetchVideoTranscript', video_id, 'Downloading GraphQL subtitles JSON', fatal=False)
```

Code after:
                    'quality': quality,
                    **video_properties,
                }

        raw_url = self._call_url_api('raw-url', video_id)
        formats.extend(get_formats(raw_url, 'raw', quality=1))  # original quality

        transcoded_url = self._call_url_api('transcoded-url', video_id)
        formats.extend(get_formats(transcoded_url, 'transcoded', quality=-1))  # transcoded quality

        cdn_url = traverse_obj(video_data, ('data', 'getVideo', 'nullableRawCdnUrl', 'url', {url_or_none}))
        # cdn_url is usually a dupe, but the raw-url/transcoded-url endpoints could return errors
        valid_urls = [update_url(url, query=None) for url in (raw_url, transcoded_url) if url]
        if cdn_url and update_url(cdn_url, query=None) not in valid_urls:
            formats.extend(get_formats(cdn_url, 'cdn', quality=0))  # could be original or transcoded

        return formats

    def _get_subtitles(self, video_id):
        subs_data = self._call_graphql_api(
            'FetchVideoTranscript', video_id, 'Downloading GraphQL subtitles JSON', fatal=False)
        return filter_dict({
            'en': traverse_obj(subs_data, (
                'data', 'fetchVideoTranscript',
                ('source_url', 'captions_source_url'), {
                    'url': {url_or_none},
                })) or None,
        })

    def _real_extract(self, url):
        video_id = self._match_id(url)
        metadata = traverse_obj(
            self._call_graphql_api('GetVideoSSR', video_id, 'Downloading GraphQL metadata JSON', fatal=False),
            ('data', 'getVideo', {dict})) or {}

        if metadata.get('__typename') == 'VideoPasswordMissingOrIncorrect':
            if not self.get_param('videopassword'):
                raise ExtractorError(
                    'This video is password-protected, use the --video-password option', expected=True)
            raise ExtractorError('Invalid video password', expected=True)

        video_data = self._call_graphql_api(
            'GetVideoSource', video_id, 'Downloading GraphQL video JSON')
        chapter_data = self._call_graphql_api(
            'FetchChapters', video_id, 'Downloading GraphQL chapters JSON', fatal=False)
        duration = traverse_obj(metadata, ('video_properties', 'duration', {int_or_none}))

        return {
            'id': video_id,
            'duration': duration,
            'chapters': self._extract_chapters_from_description(