yt_transcript_formatters

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseFormatter

type BaseFormatter struct {
	IncludeTimestamps bool
}

type Formatter

type Formatter interface {
	Format(transcripts []yt_transcript_models.Transcript) (string, error)
}

type FormatterOption

type FormatterOption func(f *BaseFormatter)

func WithTimestamps

func WithTimestamps(include bool) FormatterOption

type JSONFormatter

type JSONFormatter struct {
	BaseFormatter
	PrettyPrint bool
}

func NewJSONFormatter

func NewJSONFormatter(baseOptions ...FormatterOption) *JSONFormatter

func (*JSONFormatter) Configure

func (f *JSONFormatter) Configure(options ...JSONFormatterOption)

func (*JSONFormatter) Format

func (f *JSONFormatter) Format(transcripts []yt_transcript_models.Transcript) (string, error)

type JSONFormatterOption

type JSONFormatterOption func(*JSONFormatter)

func WithPrettyPrint

func WithPrettyPrint(pretty bool) JSONFormatterOption

type JSONTranscriptLine

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

type JSONTranscripts

type JSONTranscripts struct {
	LanguageCode string               `json:"language_code"`
	Transcripts  []JSONTranscriptLine `json:"transcripts"`
}

type TextFormatter

type TextFormatter struct {
	BaseFormatter
}

func NewTextFormatter

func NewTextFormatter(options ...FormatterOption) *TextFormatter

func (*TextFormatter) Format

func (t *TextFormatter) Format(transcripts []yt_transcript_models.Transcript) (string, error)

Jump to

Keyboard shortcuts

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