captions

Reach for this when caption text from a YouTube video is wanted: reading a video instead of watching it, quoting or translating speech, accessibility (deaf/HoH) needs, content revi…

artemchuikin

@artemchuikin

Install

$ openclaw skills install @artemchuikin/captions

Captions

Extract closed captions from YouTube videos via TranscriptOut.com.

Setup

If $TRANSCRIPTOUT_API_KEY is not set, read references/auth-setup.md and follow the instructions there to get and store the key.

Required Header

Every request needs one header:

  • Authorization: Bearer $TRANSCRIPTOUT_API_KEY

Every response is one JSON envelope. Success: {"ok": true, "request_id": "...", "data": {...}}. Error: {"ok": false, "code": "...", "detail": "...", "request_id": "..."}. Branch on the machine-readable code, not on the human text. The remaining credit balance rides in the X-Credits-Remaining response header.

GET /v1/transcript · 1 credit

Fetch the closed captions of any YouTube video: timed JSON segments, plain text, or ready-made SRT/VTT files.

# SRT body inside the JSON envelope
curl -s "https://api.transcriptout.com/v1/transcript?video=VIDEO_URL_OR_ID&format=srt" \
  -H "Authorization: Bearer $TRANSCRIPTOUT_API_KEY"

# or the raw .srt file itself
curl -s "https://api.transcriptout.com/v1/transcript?video=VIDEO_URL_OR_ID&format=srt&download=true" \
  -H "Authorization: Bearer $TRANSCRIPTOUT_API_KEY"
ParamRequiredDefaultValues
videoyes-YouTube URL (full/short/shorts) or 11-char video ID
langnoenlanguage code of the track (en, de, ...)
formatnojsonjson, text, srt, vtt, srv3
kindnomanual if presentmanual, auto
segmentnoauto tracks: 180 (80 for srt/vtt). Manual tracks keep the author's lines20-5000, max characters per segment
video_metadatanofalsetrue adds data.metadata (title, channel, duration, views) for the same 1 credit
downloadnofalsetrue returns the raw file instead of the JSON envelope (text/srt/vtt/srv3 only)

With format=srt or format=vtt the default segmenting for auto-generated tracks is subtitle-sized (~80 characters per cue). Manual tracks keep the author's own line breaks in every format. download=true returns the bare file instead of the JSON envelope.

Response for format=json. With format=text/srt/vtt/srv3 the transcript field is one string in that format:

{
  "ok": true,
  "request_id": "req_...",
  "data": {
    "video_id": "dQw4w9WgXcQ",
    "language": "en",
    "kind": "manual",
    "transcript": [
      { "text": "Never gonna give you up", "start": 18.0, "duration": 4.12 },
      { "text": "Never gonna let you down", "start": 22.12, "duration": 3.85 }
    ],
    "available_langs": [
      { "code": "en", "kind": "manual", "name": "English" },
      { "code": "en", "kind": "auto", "name": "English (auto-generated)" }
    ]
  }
}

Tips

  • format=text is the cheapest form to reason over. Ask for json only when timestamps matter.
  • Transcript AND title/channel wanted? One call: video_metadata=true. Never a separate /v1/video first.
  • Transcribe last: search and listings are for choosing, and pulling transcripts for a whole results page nobody asked to read is the fastest way to burn a balance.

Errors

CodeMeaningAction
400/422Bad parameterFix the request. Credit refunded automatically
401Bad or missing API keyCheck the key. It must start with sk_
402Out of creditstranscriptout.com/billing
404No captions on that language/track, or bad IDDefinitive answer, do not retry. Try another lang or kind=auto. Billed
410Video removedDo not retry
451Age-restricted or members-onlyDo not retry
429Rate limit (200 req/min per key)Wait, respect Retry-After. Refunded
502Failed on YouTube's sideOne retry is reasonable. Billed
503Service at capacityRetry after Retry-After. Refunded

Every error body carries a machine-readable code and a request_id. Include the request_id when contacting support.

Top skills in this category