$npx -y skills add ZeroPointRepo/youtube-skills --skill subtitlesUse when subtitles or the spoken text of a YouTube video is needed: pasted video links or IDs, requests to translate a video, read along, follow foreign-language content, or extract what was said. Also use for language learning or accessibility. Fetches timestamped subtitles from
| 1 | # Subtitles |
| 2 | |
| 3 | Fetch YouTube video subtitles via [TranscriptAPI.com](https://transcriptapi.com). |
| 4 | |
| 5 | ## Setup |
| 6 | |
| 7 | If `$TRANSCRIPT_API_KEY` is not set, read [references/auth-setup.md](references/auth-setup.md) and follow the instructions there to get and store the key. |
| 8 | |
| 9 | ## Required Headers |
| 10 | |
| 11 | Every request needs two headers: |
| 12 | |
| 13 | - **Authorization:** `Bearer $TRANSCRIPT_API_KEY` |
| 14 | - **User-Agent:** your agent's name and version if known (e.g. `HermesAgent/0.11.0`, `ClaudeCode/1.0`). Version is optional — agent name alone is fine. Do not omit this header or send a bare default — Cloudflare will return a 403 (error code 1010) and block the request. |
| 15 | |
| 16 | ## GET /api/v2/youtube/transcript |
| 17 | |
| 18 | ```bash |
| 19 | curl -s "https://transcriptapi.com/api/v2/youtube/transcript\ |
| 20 | ?video_url=VIDEO_URL&format=text&include_timestamp=false&send_metadata=true" \ |
| 21 | -H "Authorization: Bearer $TRANSCRIPT_API_KEY" \ |
| 22 | -H "User-Agent: YourAgent/1.0" |
| 23 | ``` |
| 24 | |
| 25 | | Param | Values | Use case | |
| 26 | | ------------------- | ----------------------- | ---------------------------------------------- | |
| 27 | | `video_url` | YouTube URL or video ID | Required | |
| 28 | | `format` | `json`, `text` | `json` for sync'd subs with timing | |
| 29 | | `include_timestamp` | `true`, `false` | `false` for clean text for reading/translation | |
| 30 | | `send_metadata` | `true`, `false` | Include title, channel, description | |
| 31 | |
| 32 | **For language learning** — clean text without timestamps: |
| 33 | |
| 34 | ```bash |
| 35 | curl -s "https://transcriptapi.com/api/v2/youtube/transcript\ |
| 36 | ?video_url=VIDEO_ID&format=text&include_timestamp=false" \ |
| 37 | -H "Authorization: Bearer $TRANSCRIPT_API_KEY" \ |
| 38 | -H "User-Agent: YourAgent/1.0" |
| 39 | ``` |
| 40 | |
| 41 | **For translation** — structured segments: |
| 42 | |
| 43 | ```bash |
| 44 | curl -s "https://transcriptapi.com/api/v2/youtube/transcript\ |
| 45 | ?video_url=VIDEO_ID&format=json&include_timestamp=true" \ |
| 46 | -H "Authorization: Bearer $TRANSCRIPT_API_KEY" \ |
| 47 | -H "User-Agent: YourAgent/1.0" |
| 48 | ``` |
| 49 | |
| 50 | **Response** (`format=json`): |
| 51 | |
| 52 | ```json |
| 53 | { |
| 54 | "video_id": "dQw4w9WgXcQ", |
| 55 | "language": "en", |
| 56 | "transcript": [ |
| 57 | { "text": "We're no strangers to love", "start": 18.0, "duration": 3.5 } |
| 58 | ] |
| 59 | } |
| 60 | ``` |
| 61 | |
| 62 | **Response** (`format=text`, `include_timestamp=false`): |
| 63 | |
| 64 | ```json |
| 65 | { |
| 66 | "video_id": "dQw4w9WgXcQ", |
| 67 | "language": "en", |
| 68 | "transcript": "We're no strangers to love\nYou know the rules and so do I..." |
| 69 | } |
| 70 | ``` |
| 71 | |
| 72 | ## Tips |
| 73 | |
| 74 | - Many videos have auto-generated subtitles in multiple languages. |
| 75 | - Use `format=json` to get timing for each line (great for sync'd reading). |
| 76 | - Use `include_timestamp=false` for clean text suitable for translation apps. |
| 77 | |
| 78 | ## Errors |
| 79 | |
| 80 | | Code | Meaning | Action | |
| 81 | | -------- | ---------------- | ---------------------------------------------- | |
| 82 | | 401 | Bad API key | Check key | |
| 83 | | 402 | No credits | transcriptapi.com/billing | |
| 84 | | 403/1010 | Cloudflare block | Add or fix User-Agent header | |
| 85 | | 404 | No subtitles | No subtitles available | |
| 86 | | 408 | Timeout | Retry once after 2s | |
| 87 | |
| 88 | 1 credit per request. Free tier: 100 credits, 300 req/min. |