Documentation ¶
Index ¶
- func ConcatenateTranscript(entries []TranscriptEntry) string
- func ExtractVideoID(input string) string
- type Client
- func (c *Client) FetchMultipleTranscripts(videoIDs []string) map[string][]TranscriptEntry
- func (c *Client) GetTranscript(videoID string) ([]TranscriptEntry, error)
- func (c *Client) GetTranscriptString(videoID string) (string, error)
- func (c *Client) GetTranscriptWithLanguage(videoID string, languageCode string) ([]TranscriptEntry, error)
- func (c *Client) ListAvailableTranscripts(videoID string) ([]Transcript, error)
- type ClientOption
- type ErrNoTranscriptFound
- type ErrTranscriptsDisabled
- type ErrVideoUnavailable
- type Transcript
- type TranscriptEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConcatenateTranscript ¶
func ConcatenateTranscript(entries []TranscriptEntry) string
ConcatenateTranscript combines all transcript entries into a single string
func ExtractVideoID ¶
ExtractVideoID extracts the video ID from various YouTube URL formats or returns the ID directly. It supports full youtube.com URLs, short youtu.be URLs, and direct video IDs.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents the YouTube Transcript API client
func NewClient ¶
func NewClient(options ...ClientOption) *Client
NewClient creates a new YouTube Transcript API client
func (*Client) FetchMultipleTranscripts ¶
func (c *Client) FetchMultipleTranscripts(videoIDs []string) map[string][]TranscriptEntry
FetchMultipleTranscripts fetches transcripts for multiple video IDs concurrently
func (*Client) GetTranscript ¶
func (c *Client) GetTranscript(videoID string) ([]TranscriptEntry, error)
GetTranscript fetches the transcript for a given video ID, preferring English if available
func (*Client) GetTranscriptString ¶
GetTranscriptString fetches the transcript and returns it as a single string
func (*Client) GetTranscriptWithLanguage ¶
func (c *Client) GetTranscriptWithLanguage(videoID string, languageCode string) ([]TranscriptEntry, error)
GetTranscriptWithLanguage fetches the transcript for a given video ID in the specified language code If the specified language is not available, it returns an error
func (*Client) ListAvailableTranscripts ¶
func (c *Client) ListAvailableTranscripts(videoID string) ([]Transcript, error)
ListAvailableTranscripts returns a list of available transcript languages for a video
type ClientOption ¶
type ClientOption func(*Client)
ClientOption defines a function to configure the Client
func WithProxy ¶
func WithProxy(proxyURLStr string) ClientOption
WithProxy sets a proxy for the HTTP client
type ErrNoTranscriptFound ¶
type ErrNoTranscriptFound struct {
VideoID string
}
func (ErrNoTranscriptFound) Error ¶
func (e ErrNoTranscriptFound) Error() string
type ErrTranscriptsDisabled ¶
type ErrTranscriptsDisabled struct {
VideoID string
}
func (ErrTranscriptsDisabled) Error ¶
func (e ErrTranscriptsDisabled) Error() string
type ErrVideoUnavailable ¶
type ErrVideoUnavailable struct {
}Error types
func (ErrVideoUnavailable) Error ¶
func (e ErrVideoUnavailable) Error() string
type Transcript ¶
Transcript represents a single transcript
type TranscriptEntry ¶
TranscriptEntry represents a single entry in the transcript