MCPcopy
hub / github.com/jdepoix/youtube-transcript-api / fetch

Method fetch

youtube_transcript_api/_api.py:51–74  ·  view source on GitHub ↗

Retrieves the transcript for a single video. This is just a shortcut for calling: `YouTubeTranscriptApi().list(video_id).find_transcript(languages).fetch(preserve_formatting=preserve_formatting)` :param video_id: the ID of the video you want to retrieve the transcri

(
        self,
        video_id: str,
        languages: Iterable[str] = ("en",),
        preserve_formatting: bool = False,
    )

Source from the content-addressed store, hash-verified

49 self._fetcher = TranscriptListFetcher(http_client, proxy_config=proxy_config)
50
51 def fetch(
52 self,
53 video_id: str,
54 languages: Iterable[str] = ("en",),
55 preserve_formatting: bool = False,
56 ) -> FetchedTranscript:
57 """
58 Retrieves the transcript for a single video. This is just a shortcut for
59 calling:
60 `YouTubeTranscriptApi().list(video_id).find_transcript(languages).fetch(preserve_formatting=preserve_formatting)`
61
62 :param video_id: the ID of the video you want to retrieve the transcript for.
63 Make sure that this is the actual ID, NOT the full URL to the video!
64 :param languages: A list of language codes in a descending priority. For
65 example, if this is set to ["de", "en"] it will first try to fetch the
66 german transcript (de) and then fetch the english transcript (en) if
67 it fails to do so. This defaults to ["en"].
68 :param preserve_formatting: whether to keep select HTML text formatting
69 """
70 return (
71 self.list(video_id)
72 .find_transcript(languages)
73 .fetch(preserve_formatting=preserve_formatting)
74 )
75
76 def list(
77 self,

Callers 1

listMethod · 0.45

Calls 2

listMethod · 0.95
find_transcriptMethod · 0.80

Tested by

no test coverage detected