Skip to content

About

Get YouTube transcripts & subtitles (text, SRT, VTT, chapters) from videos, playlists, channels or searches — Python, Node.js and cURL examples. No YouTube API key.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

YouTube Transcript Scraper — Python, Node.js & cURL examples

Get the transcript of any YouTube video — and of whole playlists, channels (@handle) or search results — as clean text, timed segments, SRT / VTT subtitles and chapters with their own text. No YouTube API key, no cookies, no proxies to manage.

This repo shows how to call the hosted YouTube Transcript Scraper on Apify from your code. It costs $0.50 per 1,000 transcripts; videos without captions are free.

Why not just youtube-transcript-api?

Libraries that read captions directly work on your laptop but get "Sign in to confirm you're not a bot" as soon as they run on a server (AWS, GCP, Vercel, Docker…). The hosted Actor handles the blocking, retries and parsing for you and also lists playlists, channels and searches.

Quick start (Python)

pip install apify-client
export APIFY_TOKEN=...   # free account at apify.com → Settings → API & Integrations
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("tidydata/youtube-transcript-scraper").call(run_input={
    "sources": [
        "https://www.youtube.com/watch?v=iCvmsMzlF7o",   # a video
        "@lexfridman",                                     # a channel (newest first)
        "how to start a podcast",                          # a search
    ],
    "maxVideosPerSource": 5,
    "languages": ["en"],          # optional: preferred caption languages
    "includeSrt": True,
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    if item["status"] == "ok":
        print(item["title"], "-", item["wordCount"], "words")
        print(item["transcript"][:300], "…")

More: examples/python_basic.py · examples/python_rag_chunks.py (split by chapters for a vector DB) · examples/node.mjs · examples/curl.sh

What you get per video

field example
title, channelName, durationSeconds, viewCount video metadata
language, isAutoGenerated, availableLanguages which captions were used
transcript readable paragraphs (or plain / [mm:ss] lines)
segments [{start, duration, text}] in seconds
chapters [{title, start, end, text}] when the video has chapters
srt, vtt subtitle files as text
status, error ok, no_transcript, language_not_available… (non-ok rows are free)

Inputs it accepts

watch?v= · youtu.be/ · /shorts/ · /live/ · /embed/ links · 11-character IDs · playlist links · channel links / @handles (add /shorts or /streams for those tabs) · plain search terms.

Use it from no-code tools

The Actor works with Make, Zapier, n8n, webhooks and schedules, and as a tool for AI agents through the Apify MCP server — see the Actor page.

Related

Examples in this repo are MIT-licensed. Transcripts belong to their creators — respect copyright when you republish them.


Links to apify.com include our affiliate ID: if you start a paid Apify plan through them, Apify pays TidyData a commission at no extra cost to you.

About

Get YouTube transcripts & subtitles (text, SRT, VTT, chapters) from videos, playlists, channels or searches — Python, Node.js and cURL examples. No YouTube API key.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors