Extract YouTube transcript
Returns the transcript as timestamped segments and joined plain text. Pick the caption language with a language code (default en; en also matches en-US or en-GB). A video with no captions in that language is a 404 naming the languages it has. When YouTube is not answering on every attempt (a bot check or a "try again later"), the answer is a retryable 503 temporarily_unavailable; ask again.
/transcript Transcript https://api.fetchlayer.dev/youtube/transcript Headers
Authorization string required Bearer token — your FetchLayer API key.
Parameters
videoUrl string required YouTube video URL or 11-character video ID. Also accepts youtube.com/live/ and /embed/ links, m.youtube.com and music.youtube.com links, and http://. A URL is echoed unchanged.
language string optional Transcript language code, such as en or en-US. Optional, defaults to en. A video with no captions in that language is a 404 naming the languages it has. (default: en)
Response Fields
transcript
Extract YouTube transcript
segments object[] Array of timestamped transcript segments.
segments[].start number Start time in seconds.
segments[].duration number Duration in seconds.
segments[].text string Transcript text for this segment.
text string Full transcript as joined plain text.
Request
curl -X POST "https://api.fetchlayer.dev/youtube/transcript" \
-H "Authorization: Bearer ss-your-key" \
-H "Content-Type: application/json" \
-d '{"videoUrl":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","language":"en"}'Response
{
"segments": [
{
"start": 0,
"duration": 3.5,
"text": "We're no strangers to love"
}
],
"text": "We're no strangers to love..."
}