Skip to content

shanehull/yt-transcript

Repository files navigation

yt-transcript

Go Reference Go Report Card CI License: MIT

Fetch YouTube transcripts. No API key needed.

Install

go install github.com/shanehull/yt-transcript/cmd/yt-transcript@latest

CLI

yt-transcript dQw4w9WgXcQ                  # plain text
yt-transcript -fmt json dQw4w9WgXcQ        # JSON with timestamps
yt-transcript -fmt srt dQw4w9WgXcQ         # SRT subtitles
yt-transcript -lang fr dQw4w9WgXcQ         # French transcript

Library

import (
    "context"
    yt "github.com/shanehull/yt-transcript"
)

client := yt.NewClient()
segments, _ := client.FetchTranscript(context.Background(), "dQw4w9WgXcQ", "en")
for _, s := range segments {
    fmt.Println(s.Text)
}

Server

go run github.com/shanehull/yt-transcript/cmd/server@latest
docker run -p 8080:8080 ghcr.io/shanehull/yt-transcript
GET /{video_id}[?lang=en][&fmt=text|srt]  → transcript
curl https://yt-transcript.net/dQw4w9WgXcQ
curl https://yt-transcript.net/dQw4w9WgXcQ?fmt=text
curl https://yt-transcript.net/dQw4w9WgXcQ?fmt=srt
curl https://yt-transcript.net/dQw4w9WgXcQ?lang=fr

About

Fetch YouTube transcripts as JSON, text, or SRT. Go library, CLI, and HTTP server.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors