subtitle

package
v0.0.0-...-0e55cf6 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SRT     Subtitler = &srt{}
	LRC     Subtitler = &lrc{}
	Youtube Weber     = &youtube{}
)
View Source
var (
	ErrTranscriptDisabled          = errors.New("Subtitles are disabled in this video")
	ErrVideoUnavailable            = errors.New("The video is no longer available")
	ErrLanguageDownloadURLNotFound = errors.New("Caption download url not found; perhaps language code is incorrect")
)

Functions

func ParseVideoID

func ParseVideoID(URL string) (string, error)

Types

type Line

type Line struct {
	Index   int
	Text    string
	StartAt time.Duration
	EndAt   time.Duration
}

type Subtitler

type Subtitler interface {
	ReadFromFile(i io.Reader) ([]Line, error)
	ReadFromBytes(file []byte) ([]Line, error)
}

func NewSubtitleFactory

func NewSubtitleFactory(filetype string) Subtitler

type Weber

type Weber interface {
	GetLines(url, languageCode string) ([]Line, error)
	ListLanguages(url string) (map[string]string, error)
	GetTitle(url string) (string, error)
}

func NewWebSubtitleFactory

func NewWebSubtitleFactory(filetype string) Weber

Jump to

Keyboard shortcuts

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