Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidCharactersInVideoID = errors.New("invalid characters in video id") ErrVideoIDMinLength = errors.New("the video id must be at least 10 characters long") ErrTranscriptsDisabled = errors.New("transcripts disabled") ErrNoTranscriptFound = errors.New("no transcript found for the given language codes") ErrInvalidFormat = errors.New("invalid captions tracks format") )
Functions ¶
func ExtractVideoID ¶
ExtractVideoID extracts the videoID from the given string for a YouTube URL.
Types ¶
type Transcript ¶
type Transcript struct { VideoID string URL string Language string LanguageCode string IsGenerated bool }
Transcript represents a transcript for a YouTube video.
func (*Transcript) Fetch ¶
func (t *Transcript) Fetch() ([]TranscriptEntry, error)
Fetch fetches the transcript from the transcript URL.
type TranscriptEntry ¶
type TranscriptEntry struct { Text string `xml:",chardata"` Start float64 `xml:"start,attr"` Duration float64 `xml:"dur,attr"` }
TranscriptEntry represents a transcript entry for a YouTube video.
type TranscriptList ¶
type TranscriptList struct { VideoID string ManuallyCreatedTranscripts map[string]*Transcript GeneratedTranscripts map[string]*Transcript }
TranscriptList represents a list of transcripts for a YouTube video.
func ListTranscripts ¶
func ListTranscripts(videoID string) (*TranscriptList, error)
ListTranscripts lists the transcripts for the given videoID.
func (*TranscriptList) FindTranscript ¶
func (tl *TranscriptList) FindTranscript(languageCodes ...string) (*Transcript, error)
FindTranscript finds the first transcript that matches the language codes.
Click to show internal directories.
Click to hide internal directories.