Function Repository Resource:
YouTubeTranscript
Get YouTube transcripts
Contributed by:
Anton Antonov
ResourceFunction["YouTubeTranscript"][id] get the transcript of the YouTube video with identifier id. |
Details and Options
ResourceFunction["YouTubeTranscript"] extracts the captions of the video, if they exist.
The transcript is returned as plain text.
The YouTube Data API has usage quotas
Not all YouTube videos have automatic or manual captions. If no captions are available, the script returns a message indicating this.
ResourceFunction["YouTubeTranscript"] processes "captionTracks" of the YouTube Data API, which is a field of YouTube's video metadata.
The field "captionTracks" is an array of objects, where each object represents a single caption track (e.g., for a specific language or type).
From "captionTracks" the "baseURL" string is extracted, which is the URL to fetch the caption content.
Examples
Basic Examples (2)
Get a video transcript:
In[1]:= |
Out[2]= |
Here is an excerpt:
In[3]:= |
Out[6]= |
Scope (1)
If the video identifier is not found or the video has no captions Failure object is returned. For example:
In[7]:= |
Out[7]= |
Applications (3)
Get a video transcript:
In[8]:= |
Show the number of characters, words, and lines:
In[9]:= |
Out[10]= |
Summarize the transcript:
In[11]:= |
Out[11]= |
Neat Examples (1)
Get a video transcript and show table of themes:
In[12]:= |
Out[15]= |