Documentation
¶
Overview ¶
Package youtube extracts transcripts and metadata from YouTube videos.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
Error carries structured failure details for callers that need to branch on YouTube-specific failure modes.
type ErrorKind ¶
type ErrorKind string
ErrorKind categorizes user-facing YouTube extraction failures.
const ( // ErrorKindInvalidURL reports a malformed or unsupported YouTube URL. ErrorKindInvalidURL ErrorKind = "invalid_url" ErrorKindUnavailable ErrorKind = "unavailable" // ErrorKindPrivate reports a private video. ErrorKindPrivate ErrorKind = "private" // ErrorKindAgeRestricted reports a video that requires login/age confirmation. ErrorKindAgeRestricted ErrorKind = "age_restricted" ErrorKindTranscriptUnavailable ErrorKind = "transcript_unavailable" ErrorKindAudioUnavailable ErrorKind = "audio_unavailable" )
type ExtractOptions ¶
ExtractOptions controls transcript extraction behavior.
type Extractor ¶
type Extractor struct {
// contains filtered or unexported fields
}
Extractor orchestrates transcript extraction and optional STT fallback.
func NewExtractor ¶
func NewExtractor(cfg config.OpenRouterConfig) *Extractor
NewExtractor constructs a default extractor backed by kkdai/youtube and the OpenRouter STT client.
type Metadata ¶
type Metadata struct {
VideoID string
URL string
Title string
Channel string
Duration time.Duration
PublishDate time.Time
}
Metadata contains normalized video metadata.
type OpenRouterClient ¶
type OpenRouterClient struct {
// contains filtered or unexported fields
}
OpenRouterClient calls the OpenRouter chat completions API for STT fallback.
func NewOpenRouterClient ¶
func NewOpenRouterClient(cfg config.OpenRouterConfig) *OpenRouterClient
NewOpenRouterClient constructs an STT client from runtime configuration.
func (*OpenRouterClient) Configured ¶
func (client *OpenRouterClient) Configured() bool
Configured reports whether the client has the credentials needed to call the OpenRouter API.
func (*OpenRouterClient) Transcribe ¶
func (client *OpenRouterClient) Transcribe(ctx context.Context, audio []byte, format string) (string, error)
Transcribe sends audio bytes to OpenRouter and returns the transcript text.
type Result ¶
type Result struct {
Metadata Metadata
Markdown string
Source TranscriptSource
Language string
}
Result contains the extracted metadata and transcript markdown.
type TranscriptSource ¶
type TranscriptSource string
TranscriptSource identifies how the transcript was produced.
const ( // TranscriptSourceCaptions means YouTube captions were fetched directly. TranscriptSourceCaptions TranscriptSource = "captions" // TranscriptSourceSTT means audio was transcribed through OpenRouter. TranscriptSourceSTT TranscriptSource = "stt" )