Back to Blog

Download YouTube Transcripts as SRT Subtitle Files

5 min read

SRT (SubRip Subtitle) is the most widely supported subtitle format in video editing and playback. Whether you are adding subtitles to a repurposed video, creating accessible content, or translating captions, you need SRT files with accurate timing. This guide shows you how to download YouTube transcripts as SRT files using the YouTubeTranscripts.co API.

What is the SRT Format

SRT files are plain text files with a specific format: each subtitle block has a sequence number, a time range (start --> end), and the subtitle text. Most video editors, media players, and streaming platforms support SRT natively. The format is simple enough to edit by hand but tedious to create from scratch.

Download SRT with One API Call

Use the format=srt parameter to get the transcript pre-formatted as an SRT file.

import httpx

response = httpx.get(
    "https://api.youtubetranscripts.co/v1/transcript",
    params={
        "url": "https://youtube.com/watch?v=VIDEO_ID",
        "format": "srt",
    },
    headers={"x-api-key": "YOUR_API_KEY"},
)
data = response.json()

# Save the SRT content to a file
with open("subtitles.srt", "w", encoding="utf-8") as f:
    f.write(data["srt"])

print("Saved subtitles.srt")

SRT Format Example

Here is what the SRT output looks like. Each block has a number, timestamp range, and text.

1
00:00:18,000 --> 00:00:21,200
We're no strangers to love

2
00:00:21,200 --> 00:00:24,000
You know the rules and so do I

3
00:00:24,000 --> 00:00:27,500
A full commitment's what I'm thinking of

Batch Download SRT Files

Download SRT files for multiple videos at once using the batch API.

import httpx
import re

def slugify(text: str) -> str:
    return re.sub(r"[^a-z0-9]+", "-", text.lower()).strip("-")

# Get transcripts for multiple videos
response = httpx.post(
    "https://api.youtubetranscripts.co/v1/batch",
    json={
        "urls": [
            "https://youtube.com/watch?v=V1",
            "https://youtube.com/watch?v=V2",
        ],
        "format": "srt",
    },
    headers={"x-api-key": "YOUR_API_KEY"},
    timeout=120,
)

for item in response.json()["transcripts"]:
    if not item.get("error"):
        filename = f"{slugify(item['title'])}.srt"
        with open(filename, "w", encoding="utf-8") as f:
            f.write(item["srt"])
        print(f"Saved: {filename}")

Using SRT Files in Video Editors

Import the downloaded SRT file into your video editor: In Premiere Pro, go to File > Import and select the .srt file. In Final Cut Pro, use File > Import > Captions. In DaVinci Resolve, go to the Edit page, right-click the media pool, and choose Import Subtitle. The subtitles will appear on your timeline, properly synced to the audio.

Conclusion

Downloading YouTube transcripts as SRT files is a single API call away. Use them in any video editor, media player, or subtitle tool. The YouTubeTranscripts.co API handles the formatting so you do not have to. Get started at youtubetranscripts.co.

Ready to start extracting YouTube transcripts?

Get 150 free API requests. No credit card required.

Get Your Free API Key