transcript

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package transcript holds the caption model shared by acquisition, search, rendering, and the adapters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Timestamp

func Timestamp(seconds float64) string

Timestamp formats whole seconds as MM:SS, or HH:MM:SS past an hour.

func TimestampSRT

func TimestampSRT(seconds float64) string

TimestampSRT formats seconds as an SRT timestamp with millisecond precision.

func TruncateRunes

func TruncateRunes(s string, limit int) (string, bool)

TruncateRunes is rune-safe: byte slicing a description could split a multi-byte character. A limit of 0 means no truncation.

func WordCount

func WordCount(segs []Segment) int

WordCount counts whitespace-separated words across all cues.

Types

type Segment

type Segment struct {
	Start    float64 `json:"start"`
	Duration float64 `json:"duration"`
	Text     string  `json:"text"`
}

Segment is one caption cue.

type Transcript

type Transcript struct {
	VideoID            string    `json:"video_id"`
	Source             string    `json:"source"` // innertube-android | innertube-ios | watch-page
	Language           string    `json:"language"`
	OriginalLanguage   string    `json:"original_language"`
	TranslationTarget  string    `json:"translation_target,omitempty"`
	RequestedLanguages []string  `json:"requested_languages,omitempty"`
	Generated          bool      `json:"generated"`
	Translated         bool      `json:"translated"`
	DurationSeconds    int       `json:"duration_seconds"`
	Segments           []Segment `json:"segments"`
}

Transcript is a downloaded caption track plus its provenance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL