Get transcripts/captions for a given YouTube video using REST API. See it live.
For API implementation example, see here.
Available parameters are:
v
- a Youtube video ID that will be used to find transcripts (example:jNQXAC9IVRw
), this is requiredlist
- if it set totrue
, will return a list of transcripts available for a given video inv
param, other params will be ignoredlang
- language code to search for, multiple languages are also allowed (example:es
,ar
,en,fr,ja
), if you are not sure, uselist
parameter to see available languages code, by default, this will look for English (en
), if English not found, then first available language (alphabetically) will be usedtl
- if a language code is given, this will automatically translated into the requested languagetype
- by default, this will look for manually created transcript then auto-generated transcript, but you can get onlymanual
orgenerated
transcripts using this parameterkey
- search and only returns text that contains the requested string, as opposed to returns all text in the transcriptcs
- set this parameter totrue
to make search case sensitivemarker
- string that used as a marker before and afterkey
found in text, you can also use different markers for before and afterkey
using_$_
, for example<mark>_$_</mark>
size
- how much maximum text is returned, if not set, then return all text foundpage
- the requested page based on the value ofsize
parameter, if parametersize
isn't exist, this will be ignored, page starts at 1
Make sure you have Python, pip, Node and npm installed on your machine.
# Clone this repository and then move into that directory
git clone https://github.com/daflh/yt-transcripts.git
cd yt-transcripts
# Install required dependency for Python
pip install -r requirements.txt
# Install Vercel CLI globally using npm
npm install -g vercel
vercel login # Login to your vercel account
vercel # Link this directory to your Vercel project
vercel dev # Start the development server