Use transcripts for accessibility and captions
Make video content easier to use for everyone. Get captions in VTT or SRT, publish a transcript next to each video and review auto-generated text before it goes live.
Get API keyRead the docscurl "https://api.transcriptapi.org/v1/youtube/transcript?video=dQw4w9WgXcQ" \ -H "X-API-Key: YOUR_API_KEY"

Why this is hard without an API
In practice, captions and transcripts help people who are deaf or hard of hearing, people watching without sound and people who prefer to read.
Moreover, accessibility guidelines ask for captions on pre-recorded video. Of course, a repeatable workflow beats fixing videos one at a time.
Four steps with TranscriptAPI
accessibility compliance captions: Fetch captions
In fact, request the transcript in WebVTT or SRT for each video you publish.
accessibility compliance captions: check the quality
Overall, the response tells you whether captions are manual or auto-generated. Review auto-generated text.
accessibility compliance captions: Publish the transcript
In short, show the full text on the page next to the video.
accessibility compliance captions: Attach caption tracks
Of course, add the VTT file as a track in your player.
accessibility compliance captions: See it in code
Overall, set your API key in the TRANSCRIPTAPI_KEY environment variable. Furthermore, the helper below is used in the example.
import os, requests
API = 'https://api.transcriptapi.org'
HEADERS = {'X-API-Key': os.environ['TRANSCRIPTAPI_KEY']}
def get_transcript(video, lang='en'):
r = requests.get(API + '/v1/youtube/transcript',
params={'video': video, 'lang': lang}, headers=HEADERS)
r.raise_for_status()
return r.json()
r = requests.get(
API + '/v1/youtube/transcript',
params={'video': 'dQw4w9WgXcQ', 'format': 'vtt'},
headers=HEADERS,
)
vtt = r.text
open('captions.vtt', 'w').write(vtt)
# <track kind='captions' src='captions.vtt' srclang='en' label='English'>In fact, the transcript endpoint returns the video details and timed segments:
{
"video_id": "dQw4w9WgXcQ",
"video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"title": "Rick Astley - Never Gonna Give You Up",
"author": "Rick Astley",
"length_seconds": 213,
"language_code": "en",
"is_generated": false,
"available_languages": [
{ "language_code": "en", "name": "English", "is_generated": false }
],
"transcript": [
{ "text": "We're no strangers to love", "start": 18.64, "duration": 3.2 }
],
"cached": false
}accessibility compliance captions: why teams use it for this
Of course, captions and a readable transcript from one call.
Overall, manual vs auto-generated flag, so you know what to review.
Multiple languages where captions exist.
In short, helps toward accessibility goals. Moreover, it is not a substitute for a human review.
Tips for better results
Tip 1
Always review auto-generated captions for names, numbers and jargon.
Tip 2
Of course, publish the transcript as text on the page. Furthermore, it also helps search engines.
Tip 3
In short, keep a record of which videos have been reviewed.
Frequently asked questions
Does this make my site compliant?
Of course, captions help, but compliance depends on the quality of the captions and the rest of your site. Also, review them and check the guidelines that apply to you.
Can I get VTT and SRT?
Yes, with the format parameter where the platform supports it.
What if a video has no captions?
In short, the request returns an error and is not billed.
Related use cases
Subtitle translation
Of course, build a subtitle translation workflow
Video chapters
Create video chapters from a transcript
Podcast show notes
Generate podcast show notes from transcripts