Youtube apify transcript

Fetch YouTube transcripts via APIFY API.

How to use it

  1. Hit Copy SKILL.md — or use the Claude Code line below to get every file.
  2. Claude: ⋯ → Download .md, then Customize → Skills → Add → Upload skill.
    ChatGPT: make a Project and paste it into Instructions.
    Neither? Paste it at the top of a new chat — it works for that chat.
  3. Describe your job in plain words. The AI follows the skill from there.
Claude Code — installs the whole folder, not just SKILL.md
npx degit gooseworks-ai/goose-skills/skills/research-tools/capabilities/youtube-apify-transcript#main ~/.claude/skills/youtube-apify-transcript

For one project only, change the path to .claude/skills/youtube-apify-transcript. This skill also uses transcript.txt, transcript.json, urls.txt, all_transcripts.json — copying SKILL.md alone won't be enough. See the folder on GitHub.

Not working?
  • Check which app you pasted it into — the steps above name the right one.
  • Some skills need the paid tier of Claude or ChatGPT.
Step-by-step guide with screenshots · Ask in the forum

Paste into Claude, ChatGPT or Cursor.

Show the full text165 lines
youtube-apify-transcript/SKILL.md165 lines4.1 KBpushed 96d agoRawView on GitHub

youtube-apify-transcript

Fetch YouTube transcripts via APIFY API (works from cloud IPs, bypasses YouTube bot detection).

Why APIFY?

YouTube blocks transcript requests from cloud IPs (AWS, GCP, etc.). APIFY runs the request through residential proxies, bypassing bot detection reliably.

Free Tier

  • $5/month free credits (~714 videos)
  • No credit card required
  • Perfect for personal use

Cost

Links

Setup

  1. Create free APIFY account: https://apify.com/
  2. Get your API token: https://console.apify.com/account/integrations
  3. Set environment variable:
# Add to ~/.bashrc or ~/.zshrc
export APIFY_API_TOKEN="apify_api_YOUR_TOKEN_HERE"

# Or use .env file (never commit this!)
echo 'APIFY_API_TOKEN=apify_api_YOUR_TOKEN_HERE' >> .env

Usage

Basic Usage

# Get transcript as text (uses cache by default)
python3 scripts/fetch_transcript.py "https://www.youtube.com/watch?v=VIDEO_ID"

# Short URL also works
python3 scripts/fetch_transcript.py "https://youtu.be/VIDEO_ID"

Options

# Output to file
python3 scripts/fetch_transcript.py "URL" --output transcript.txt

# JSON format (includes timestamps)
python3 scripts/fetch_transcript.py "URL" --json

# Both: JSON to file
python3 scripts/fetch_transcript.py "URL" --json --output transcript.json

# Specify language preference
python3 scripts/fetch_transcript.py "URL" --lang de

Caching (saves money!)

Transcripts are cached locally by default. Repeat requests for the same video cost $0.

# First request: fetches from APIFY ($0.007)
python3 scripts/fetch_transcript.py "URL"

# Second request: uses cache (FREE!)
python3 scripts/fetch_transcript.py "URL"
# Output: [cached] Transcript for: VIDEO_ID

# Bypass cache (force fresh fetch)
python3 scripts/fetch_transcript.py "URL" --no-cache

# View cache stats
python3 scripts/fetch_transcript.py --cache-stats

# Clear all cached transcripts
python3 scripts/fetch_transcript.py --clear-cache

Cache location: .cache/ in skill directory (override with YT_TRANSCRIPT_CACHE_DIR env var)

Batch Mode

Process multiple videos at once:

# Create a file with URLs (one per line)
cat > urls.txt << EOF
https://youtube.com/watch?v=VIDEO1
https://youtu.be/VIDEO2
https://youtube.com/watch?v=VIDEO3
EOF

# Process all URLs
python3 scripts/fetch_transcript.py --batch urls.txt

# Batch with JSON output to file
python3 scripts/fetch_transcript.py --batch urls.txt --json --output all_transcripts.json

APIFY Actor Input

The script sends the following input to pintostudio/youtube-transcript-scraper:

{
  "videoUrl": "https://www.youtube.com/watch?v=VIDEO_ID"
}

Output fields:

Each result contains a data array of transcript segments:

Field Type Description
start number Segment start time (seconds)
dur number Segment duration (seconds)
text string Transcript text for this segment

Output Formats

Text (default):

Hello and welcome to this video.
Today we're going to talk about...

JSON (--json):

{
  "video_id": "dQw4w9WgXcQ",
  "title": "Video Title",
  "transcript": [
    {"start": 0.0, "dur": 2.5, "text": "Hello and welcome"},
    {"start": 2.5, "dur": 3.0, "text": "to this video"}
  ],
  "full_text": "Hello and welcome to this video..."
}

Error Handling

The script handles common errors:

  • Invalid YouTube URL
  • Video has no transcript
  • API quota exceeded
  • Network errors
1---
2name: youtube-apify-transcript
3description: Fetch YouTube transcripts via APIFY API. Works from cloud IPs (Hetzner, AWS, etc.) by bypassing YouTube's bot detection. Free tier includes $5/month credits (~714 videos). No credit card required.
4tags: [research]
5---
6 
7# youtube-apify-transcript
8 
9Fetch YouTube transcripts via APIFY API (works from cloud IPs, bypasses YouTube bot detection).
10 
11## Why APIFY?
12 
13YouTube blocks transcript requests from cloud IPs (AWS, GCP, etc.). APIFY runs the request through residential proxies, bypassing bot detection reliably.
14 
15## Free Tier
16 
17- **$5/month free credits** (~714 videos)
18- No credit card required
19- Perfect for personal use
20 
21## Cost
22 
23- **$0.007 per video** (less than 1 cent!)
24- Track usage at: https://console.apify.com/billing
25 
26## Links
27 
28- [APIFY Pricing](https://apify.com/pricing)
29- [Get API Key](https://console.apify.com/account/integrations)
30- [YouTube Transcript Scraper Actor](https://apify.com/pintostudio/youtube-transcript-scraper)
31 
32## Setup
33 
341. Create free APIFY account: https://apify.com/
352. Get your API token: https://console.apify.com/account/integrations
363. Set environment variable:
37 
38```bash
39# Add to ~/.bashrc or ~/.zshrc
40export APIFY_API_TOKEN="apify_api_YOUR_TOKEN_HERE"
41 
42# Or use .env file (never commit this!)
43echo 'APIFY_API_TOKEN=apify_api_YOUR_TOKEN_HERE' >> .env
44```
45 
46## Usage
47 
48### Basic Usage
49 
50```bash
51# Get transcript as text (uses cache by default)
52python3 scripts/fetch_transcript.py "https://www.youtube.com/watch?v=VIDEO_ID"
53 
54# Short URL also works
55python3 scripts/fetch_transcript.py "https://youtu.be/VIDEO_ID"
56```
57 
58### Options
59 
60```bash
61# Output to file
62python3 scripts/fetch_transcript.py "URL" --output transcript.txt
63 
64# JSON format (includes timestamps)
65python3 scripts/fetch_transcript.py "URL" --json
66 
67# Both: JSON to file
68python3 scripts/fetch_transcript.py "URL" --json --output transcript.json
69 
70# Specify language preference
71python3 scripts/fetch_transcript.py "URL" --lang de
72```
73 
74### Caching (saves money!)
75 
76Transcripts are cached locally by default. Repeat requests for the same video cost $0.
77 
78```bash
79# First request: fetches from APIFY ($0.007)
80python3 scripts/fetch_transcript.py "URL"
81 
82# Second request: uses cache (FREE!)
83python3 scripts/fetch_transcript.py "URL"
84# Output: [cached] Transcript for: VIDEO_ID
85 
86# Bypass cache (force fresh fetch)
87python3 scripts/fetch_transcript.py "URL" --no-cache
88 
89# View cache stats
90python3 scripts/fetch_transcript.py --cache-stats
91 
92# Clear all cached transcripts
93python3 scripts/fetch_transcript.py --clear-cache
94```
95 
96Cache location: `.cache/` in skill directory (override with `YT_TRANSCRIPT_CACHE_DIR` env var)
97 
98### Batch Mode
99 
100Process multiple videos at once:
101 
102```bash
103# Create a file with URLs (one per line)
104cat > urls.txt << EOF
105https://youtube.com/watch?v=VIDEO1
106https://youtu.be/VIDEO2
107https://youtube.com/watch?v=VIDEO3
108EOF
109 
110# Process all URLs
111python3 scripts/fetch_transcript.py --batch urls.txt
112 
113# Batch with JSON output to file
114python3 scripts/fetch_transcript.py --batch urls.txt --json --output all_transcripts.json
115```
116 
117## APIFY Actor Input
118 
119The script sends the following input to `pintostudio/youtube-transcript-scraper`:
120 
121```json
122{
123 "videoUrl": "https://www.youtube.com/watch?v=VIDEO_ID"
124}
125```
126 
127**Output fields:**
128 
129Each result contains a `data` array of transcript segments:
130 
131| Field | Type | Description |
132|---------|--------|------------------------------------|
133| `start` | number | Segment start time (seconds) |
134| `dur` | number | Segment duration (seconds) |
135| `text` | string | Transcript text for this segment |
136 
137### Output Formats
138 
139**Text (default):**
140```
141Hello and welcome to this video.
142Today we're going to talk about...
143```
144 
145**JSON (--json):**
146```json
147{
148 "video_id": "dQw4w9WgXcQ",
149 "title": "Video Title",
150 "transcript": [
151 {"start": 0.0, "dur": 2.5, "text": "Hello and welcome"},
152 {"start": 2.5, "dur": 3.0, "text": "to this video"}
153 ],
154 "full_text": "Hello and welcome to this video..."
155}
156```
157 
158## Error Handling
159 
160The script handles common errors:
161- Invalid YouTube URL
162- Video has no transcript
163- API quota exceeded
164- Network errors
165 

Discussion

Alternatives

Also in Scraping & extraction