youtube

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAudio

func ExtractAudio(ctx context.Context, youtubeID string) (string, func(), error)

ExtractAudio downloads audio from a YouTube video using yt-dlp. Returns the path to the downloaded MP3 file and a cleanup function.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client wraps YouTube transcript and metadata extraction.

func NewClient

func NewClient(subLangs []string) *Client

NewClient creates a YouTube client.

func (*Client) FetchMetadata

func (c *Client) FetchMetadata(ctx context.Context, youtubeID string) (*Metadata, error)

FetchMetadata retrieves video metadata from the YouTube watch page.

func (*Client) FetchTranscript

func (c *Client) FetchTranscript(_ context.Context, youtubeID string) (*Transcript, error)

FetchTranscript fetches captions using the YouTube InnerTube API.

type Metadata

type Metadata struct {
	Title           string `json:"title"`
	Channel         string `json:"channel"`
	DurationSeconds int    `json:"duration_seconds"`
	Language        string `json:"language"`
}

Metadata holds video metadata from YouTube.

type Transcript

type Transcript struct {
	Text     string `json:"text"`
	Language string `json:"language"`
	Source   string `json:"source"` // "manual", "auto"
}

Transcript holds the extracted transcript and its source.

Jump to

Keyboard shortcuts

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