YouTube Transcript Scraper — Subtitles & Captions for RAG avatar

YouTube Transcript Scraper — Subtitles & Captions for RAG

Pricing

from $4.00 / 1,000 trends queries

Go to Apify Store
YouTube Transcript Scraper — Subtitles & Captions for RAG

YouTube Transcript Scraper — Subtitles & Captions for RAG

Fetch YouTube video transcripts and subtitles as clean text or timestamped segments. Perfect for RAG pipelines, content analysis, and AI agents. Use via Apify Console/API or connect as an MCP server for Claude, Cursor, and other AI agents.

Pricing

from $4.00 / 1,000 trends queries

Rating

0.0

(0)

Developer

Aaron Hampton

Aaron Hampton

Maintained by Community

Actor stats

0

Bookmarked

1

Total users

0

Monthly active users

a day ago

Last modified

Share

Fetch YouTube video transcripts and subtitles as clean text or timestamped segments. Perfect for RAG pipelines, content analysis, accessibility tools, and AI agents.

Features

  • Single & batch mode — fetch one video's transcript or walk an entire channel
  • Full-text search — search across multiple video transcripts for specific topics
  • Language selection — prefer a specific language, fall back to auto-generated captions
  • Timestamped segments — get clean { start, duration, text } segments or plain text
  • Dual-mode — run as a normal Apify Actor OR connect as an MCP server for Claude, Cursor, and other AI agents
  • No browser required — uses YouTube's internal timedtext API directly

Use Cases

  • RAG pipelines — feed transcripts into vector databases for Q&A over video content
  • Content analysis — extract key topics, sentiment, or keywords from video transcripts
  • Accessibility — get subtitles for videos that lack proper captioning
  • AI agents — let Claude/Cursor read video content via MCP tools
  • Research — search across many video transcripts to find specific information

Input (Normal Actor Mode)

FieldTypeDescription
videoUrlsarrayYouTube video URLs to fetch transcripts from
channelUrlstringChannel URL to fetch recent video transcripts
maxVideosintegerMax videos from channel (default 10, max 50)
includeTimestampsbooleanInclude timing data (default true)
languagestringPreferred language code (default "en")
formatenum"text", "segments", or "both" (default "both")

Output

{
"videoId": "dQw4w9gWgXc",
"videoUrl": "https://youtube.com/watch?v=dQw4w9gWgXc",
"title": "Video Title",
"language": "en",
"isAutoGenerated": false,
"text": "Full plain text transcript...",
"segments": [
{ "start": 0.0, "duration": 3.5, "text": "First segment" },
{ "start": 3.5, "duration": 2.1, "text": "Second segment" }
],
"fetchedAt": "2026-07-04T00:00:00.000Z"
}

MCP Tools (Standby Mode)

get_transcript

Fetch a single video's transcript.

{
"videoUrl": "https://www.youtube.com/watch?v=dQw4w9gWgXc",
"language": "en",
"format": "both"
}

get_channel_transcripts

Batch-fetch transcripts for a channel's recent videos.

{
"channelUrl": "https://www.youtube.com/@channelname",
"maxVideos": 10,
"language": "en"
}

search_transcripts

Search across multiple video transcripts for a query.

{
"query": "machine learning",
"videoUrls": [
"https://www.youtube.com/watch?v=abc",
"https://www.youtube.com/watch?v=def"
]
}

Pricing (Pay Per Event)

EventPriceFree Tier
Actor start$0.00005
Transcript fetched$0.005First 3 free per run/tool call
MCP tool call$0.01

Tiered discounts available (Bronze → Diamond).

Technical Approach

  1. Fetch the YouTube watch page HTML
  2. Extract ytInitialPlayerResponse JSON containing caption track metadata
  3. Select the best caption track (manual > ASR, preferred language > fallback)
  4. Fetch the timedtext XML from the caption track's baseUrl
  5. Parse XML into clean segments with timestamps
  6. Fallback to direct timedtext API if watch page scraping fails

Development

npm install # Install dependencies
npm run build # Compile TypeScript
npm test # Run tests
npm run start:dev # Run in dev mode

Author

Aaron Hampton

License

ISC