Skip to content

About

Timestamped captions to JSON. No API key, no login. Python, Node.js and cURL clients for the YouTube Transcript Downloader on Apify, pay per result.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

YouTube Transcript Downloader: Text, SRT & VTT, No API Key

Fetch timestamped YouTube transcripts and captions as clean JSON without any API key or Google login. Supports any URL form: watch links, youtu.be, Shorts, and bare video IDs. Returns segments with start time and duration, a fullText string for RAG ingestion, and character count. Works as an MCP server in Claude, ChatGPT and any AI agent.

Run it on Apify: apify.com/themineworks/youtube-transcript-scraper Docs, FAQ and pricing: themineworks.com/actors/youtube-transcript-scraper

Price: From $1.50 per 1,000 transcripts on Apify's higher plans ($2.50 on the free plan). Failed and empty results are never charged.

What it returns

  • No API key or login required
  • Timestamped segments with start + duration
  • fullText field ready for RAG and LLMs
  • Prefers manual captions, falls back to auto-generated
  • Works with any YouTube URL format including Shorts

Quick start

You need a free Apify account and its API token (Settings, API & Integrations).

Python

pip install apify-client
from apify_client import ApifyClient

client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("themineworks/youtube-transcript-scraper").call(run_input={
    "videoUrls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "language": "en"
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

Node.js

npm install apify-client
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('themineworks/youtube-transcript-scraper').call({
    "videoUrls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "language": "en"
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);

cURL

One request that runs the actor and returns the results in the response (for runs under 5 minutes):

curl -X POST "https://api.apify.com/v2/acts/themineworks~youtube-transcript-scraper/run-sync-get-dataset-items?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"], "language": "en"}'

Command line

This repo includes ready-made clients that save results to JSON and CSV:

python3 youtube_transcript_scraper.py --token YOUR_APIFY_TOKEN --video-urls "https://www.youtube.com/watch?v=dQw4w9WgXcQ" --language "en"
node youtube_transcript_scraper.mjs --token YOUR_APIFY_TOKEN --video-urls "https://www.youtube.com/watch?v=dQw4w9WgXcQ" --language "en"

Input

Field Type Default Description
videoUrls array One or more YouTube videos, one per line
outputFormats array ["text", "segments"] Which transcript formats to return on each row
language string "en" Language code of the caption track to prefer, for example en, es, hi, fr or pt
includeTimestamps boolean true When on, rows include the segments array (start time and duration of each line, in seconds) if segments is…

Output

One row per result, as JSON, CSV, Excel or through the API.

Field Type Description
videoId string The 11-character YouTube video ID
url string Canonical watch URL for the video (or the raw input when no video ID could be found)
title string Video title, when YouTube returned it
language string Language code of the caption track that was used
isAutoGenerated boolean True if the caption track is auto-generated by YouTube, false if it was uploaded or written by a person
segmentCount integer Number of transcript lines
charCount integer Character length of the full transcript text
fullText string The whole transcript as one readable string (output format: text)
segments array Ordered transcript lines, each { start, dur, text } in seconds (output format: segments, with…
srt string The transcript as an SRT subtitle file (output format: srt)
vtt string The transcript as a WebVTT subtitle file (output format: vtt)
status string ok (transcript returned, charged), no-caption-track or error (not charged), stopped or summary (run…
reason string Why a row is not ok, for example no-tracks-listed, video-unavailable, invalid-video-id, bot-check or…
error string Plain-language explanation for a row that is not ok
availableLanguages array Caption languages the video offers, when the requested one could not be used
message string Explanation on a stopped or empty-input row
videosNotAttempted integer On a stopped or summary row: videos not processed and not charged
notAttempted array On a stopped row: the inputs that were not processed, ready to paste into a new run
scrapedAt string ISO timestamp when the row was written

Use it from an AI agent

The actor works as a tool in Claude, Cursor or any MCP client through Apify's MCP server:

https://mcp.apify.com/?tools=themineworks/youtube-transcript-scraper

FAQ

How does it get transcripts without the YouTube API?

YouTube embeds caption track metadata in the watch page HTML inside the ytInitialPlayerResponse object. The actor extracts the timedtext endpoint URL from that response and fetches the caption XML directly. No API key or quota needed.

What happens if a video has no captions?

The actor returns status "no-captions" for that video. You are not charged for videos without captions, only for transcripts actually delivered.

Does it work with auto-generated (ASR) captions?

Yes. When no manual transcript is available it falls back to the auto-generated track. The isAutoGenerated field in the output tells you which was used.

What language is returned?

The actor picks the track that best matches your preferred language. It tries an exact match first, then a language-prefix match (for example "en" matches "en-US"), then the video's default audio language, then the first available track.

How much does the YouTube Transcript Downloader cost?

From $1.50 per 1,000 transcripts on Apify's higher plans ($2.50 on the free plan). Failed and empty results are never charged. You can cap what a single run may spend with the maximum cost setting on Apify.

Can I export the results to CSV or Excel?

Yes. Every run saves to an Apify dataset you can download as JSON, CSV, Excel or XML, or read through the API. The Python and Node clients in this repo also write the results to local files.

Can I run it on a schedule?

Yes. Save your input as a task on Apify and attach a schedule, or call the API from your own cron job. Scheduled runs are billed the same way as manual ones.

Related scrapers

Part of The Mine Works: 151 pay-per-result scrapers with no login and no browser setup on your side.

License

MIT © The Mine Works

About

Timestamped captions to JSON. No API key, no login. Python, Node.js and cURL clients for the YouTube Transcript Downloader on Apify, pay per result.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages