INNER CODE UNIT · Python
fetch
jdepoix/youtube-transcript-api · youtube_transcript_api/_api.py:51
def fetch(
self,
video_id: str,
languages: Iterable[str] = ("en",),
preserve_formatting: bool = False,
) -> FetchedTranscript:
"""
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 transcript for.
Make sure that this is the actual ID, NOT the full URL to the video!
:param languages: A list of language codes in a descending priority. For
example, if this is set to ["de", "en"] it will first try to fetch the
german transcript (de) and then fetch the english transcript (en) if
it fails to do so. This defaults to ["en"].
:param preserve_formatting: whether to keep select HTML text formatting