| name | youtube-apify-transcript |
| version | 1.1.2 |
| description | 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. |
| tags | ["youtube","transcript","apify","video","subtitles","captions","cloud-ip","free-tier","web-scraping"] |
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
- Create free APIFY account: https://apify.com/
- Get your API token: https://console.apify.com/account/integrations
- Set environment variable:
export APIFY_API_TOKEN="apify_api_YOUR_TOKEN_HERE"
echo 'APIFY_API_TOKEN=apify_api_YOUR_TOKEN_HERE' >> .env
Usage
Basic Usage
python3 scripts/fetch_transcript.py "https://www.youtube.com/watch?v=VIDEO_ID"
python3 scripts/fetch_transcript.py "https://youtu.be/VIDEO_ID"
Options
python3 scripts/fetch_transcript.py "URL" --output transcript.txt
python3 scripts/fetch_transcript.py "URL" --json
python3 scripts/fetch_transcript.py "URL" --json --output transcript.json
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.
python3 scripts/fetch_transcript.py "URL"
python3 scripts/fetch_transcript.py "URL"
python3 scripts/fetch_transcript.py "URL" --no-cache
python3 scripts/fetch_transcript.py --cache-stats
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:
cat > urls.txt << EOF
https://youtube.com/watch?v=VIDEO1
https://youtu.be/VIDEO2
https://youtube.com/watch?v=VIDEO3
EOF
python3 scripts/fetch_transcript.py --batch urls.txt
python3 scripts/fetch_transcript.py --batch urls.txt --json --output all_transcripts.json
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, "duration": 2.5, "text": "Hello and welcome"},
{"start": 2.5, "duration": 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
Metadata
metadata:
clawdbot:
emoji: "📹"
requires:
env: ["APIFY_API_TOKEN"]
bins: ["python3"]