Versions in this module Expand all Collapse all v1 v1.0.0 Mar 10, 2024 Changes in this version + var AudioQuality = map[string]int + var ITags = [...]ITag + var RegexEmbedPlayerConfig = regexp.MustCompile(`yt.setConfig\((\{.*\})`) + var RegexStreamID = regexp.MustCompile(`(?i)([a-z0-9_-]{11})`) + var RegexWatchPlayerConfig = regexp.MustCompile(`var\sytInitialPlayerResponse\s*=\s*(\{.*\})`) + var VideoQuality = map[string]int + type Assets struct + CSS string + JS string + func LoadEmbedPlayerAssets(id StreamID) (Assets, error) + func LoadEmbedPlayerAssetsDeadline(id StreamID, deadline time.Time) (Assets, error) + func LoadEmbedPlayerAssetsTimeout(id StreamID, timeout time.Duration) (Assets, error) + func ParseAssetsJSON(v *fastjson.Value) Assets + func (p Assets) LoadCSS(t Transport) (string, error) + func (p Assets) LoadCSSDeadline(t Transport, deadline time.Time) (string, error) + func (p Assets) LoadCSSTimeout(t Transport, timeout time.Duration) (string, error) + func (p Assets) LoadJS(t Transport) (string, error) + func (p Assets) LoadJSDeadline(t Transport, deadline time.Time) (string, error) + func (p Assets) LoadJSTimeout(t Transport, timeout time.Duration) (string, error) + type Cipher struct + Signature string + SignaturePolicy string + URL string + func ParseCipherJSON(v *fastjson.Value) Cipher + func (c Cipher) DecodeURL(script string) (string, error) + type Client struct + func NewClient() Client + func WrapClient(transport Transport) Client + func (c *Client) Load(id StreamID) (Player, error) + func (c *Client) LoadDeadline(id StreamID, deadline time.Time) (Player, error) + func (c *Client) LoadEmbedPlayer(id StreamID) (Player, error) + func (c *Client) LoadEmbedPlayerAssets(id StreamID) (Assets, error) + func (c *Client) LoadEmbedPlayerAssetsDeadline(id StreamID, deadline time.Time) (Assets, error) + func (c *Client) LoadEmbedPlayerAssetsTimeout(id StreamID, timeout time.Duration) (Assets, error) + func (c *Client) LoadEmbedPlayerDeadline(id StreamID, deadline time.Time) (Player, error) + func (c *Client) LoadEmbedPlayerStreams(id StreamID) (Streams, error) + func (c *Client) LoadEmbedPlayerStreamsDeadline(id StreamID, deadline time.Time) (Streams, error) + func (c *Client) LoadEmbedPlayerStreamsTimeout(id StreamID, timeout time.Duration) (Streams, error) + func (c *Client) LoadEmbedPlayerTimeout(id StreamID, timeout time.Duration) (Player, error) + func (c *Client) LoadPlaylist(id string, offset uint) (PlaylistResult, error) + func (c *Client) LoadPlaylistDeadline(id string, offset uint, deadline time.Time) (PlaylistResult, error) + func (c *Client) LoadPlaylistTimeout(id string, offset uint, timeout time.Duration) (PlaylistResult, error) + func (c *Client) LoadTimeout(id StreamID, timeout time.Duration) (Player, error) + func (c *Client) LoadWatchPlayer(id StreamID) (Player, error) + func (c *Client) LoadWatchPlayerDeadline(id StreamID, deadline time.Time) (Player, error) + func (c *Client) LoadWatchPlayerTimeout(id StreamID, timeout time.Duration) (Player, error) + func (c *Client) Search(query string, page uint) (SearchResult, error) + func (c *Client) SearchDeadline(query string, page uint, deadline time.Time) (SearchResult, error) + func (c *Client) SearchTimeout(query string, page uint, timeout time.Duration) (SearchResult, error) + type ColorInfo struct + MatrixCoefficients string + Primaries string + TransferCharacteristics string + func ParseColorInfoJSON(v *fastjson.Value) ColorInfo + type Format struct + ApproxDurationMs string + AudioChannels *uint + AudioQuality *string + AudioSampleRate *string + AverageBitrate uint + Bitrate uint + Cipher *Cipher + ColorInfo *ColorInfo + ContentLength string + FPS *uint + Height uint + HighReplication bool + ITag uint + IndexRange *TimeRange + InitRange *TimeRange + LastModified string + MIMEType string + ProjectionType string + Quality string + QualityLabel string + URL *string + Width uint + func ParseFormatJSON(v *fastjson.Value) Format + func SearchForBestAudioQuality(formats Formats) (Format, bool) + func SearchForBestVideoQuality(formats Formats) (Format, bool) + func (f Format) FileExtension() string + type Formats []Format + func FilterAudioStreams(formats Formats) Formats + func FilterVideoStreams(formats Formats) Formats + func SortByAudioQuality(formats Formats) Formats + func SortByVideoQuality(formats Formats) Formats + func (f Formats) AudioOnly() Formats + func (f Formats) BestAudio() (Format, bool) + func (f Formats) BestVideo() (Format, bool) + func (f Formats) SortByAudioQuality() Formats + func (f Formats) SortByVideoQuality() Formats + func (f Formats) VideoOnly() Formats + type ITag struct + AudioBitrate int + AudioEncoding string + Extension string + FPS int + Resolution string + VideoEncoding string + type ListItem struct + Added string + Author string + CCLicense bool + CategoryID uint + Comments string + Description string + Dislikes uint + Duration string + ID StreamID + IsCC bool + IsHD bool + Keywords []string + LengthSeconds time.Duration + Likes uint + Privacy string + Rating float64 + Thumbnail string + TimeCreated time.Time + Title string + UserID string + Views string + func ParseListItem(v *fastjson.Value) ListItem + type Player struct + func Load(id StreamID) (Player, error) + func LoadDeadline(id StreamID, deadline time.Time) (Player, error) + func LoadEmbedPlayer(id StreamID) (Player, error) + func LoadEmbedPlayerDeadline(id StreamID, deadline time.Time) (Player, error) + func LoadEmbedPlayerTimeout(id StreamID, timeout time.Duration) (Player, error) + func LoadTimeout(id StreamID, timeout time.Duration) (Player, error) + func LoadWatchPlayer(id StreamID) (Player, error) + func LoadWatchPlayerDeadline(id StreamID, deadline time.Time) (Player, error) + func LoadWatchPlayerTimeout(id StreamID, timeout time.Duration) (Player, error) + func (p Player) ResolveURL(v Format) (string, error) + func (p Player) ResolveURLDeadline(v Format, deadline time.Time) (string, error) + func (p Player) ResolveURLTimeout(v Format, timeout time.Duration) (string, error) + type PlaylistResult struct + Author string + Description string + Items []ListItem + Title string + Views uint + func LoadPlaylist(id string, offset uint) (PlaylistResult, error) + func LoadPlaylistDeadline(id string, offset uint, deadline time.Time) (PlaylistResult, error) + func LoadPlaylistTimeout(id string, offset uint, timeout time.Duration) (PlaylistResult, error) + func ParsePlaylistResultJSON(v *fastjson.Value) PlaylistResult + type SearchResult struct + Hits uint + Items []ListItem + func ParseSearchResultJSON(v *fastjson.Value) SearchResult + func Search(query string, page uint) (SearchResult, error) + func SearchDeadline(query string, page uint, deadline time.Time) (SearchResult, error) + func SearchTimeout(query string, page uint, timeout time.Duration) (SearchResult, error) + type StreamID string + func ExtractStreamID(url string) (StreamID, error) + func (v StreamID) Valid() error + type Streams struct + func LoadEmbedPlayerStreams(id StreamID) (Streams, error) + func LoadEmbedPlayerStreamsDeadline(id StreamID, deadline time.Time) (Streams, error) + func LoadEmbedPlayerStreamsTimeout(id StreamID, timeout time.Duration) (Streams, error) + func (s Streams) Author() string + func (s Streams) AverageRating() float64 + func (s Streams) ChannelID() string + func (s Streams) ContextParams() string + func (s Streams) ExpiresInSeconds() string + func (s Streams) ID() StreamID + func (s Streams) Keywords() []string + func (s Streams) MuxedFormats() Formats + func (s Streams) PlayableInEmbed() bool + func (s Streams) Reason() string + func (s Streams) ShortDescription() string + func (s Streams) SourceFormats() Formats + func (s Streams) Status() string + func (s Streams) Title() string + func (s Streams) ViewCount() string + type TimeRange struct + End string + Start string + func ParseTimeRangeJSON(v *fastjson.Value) TimeRange + type Transport interface + DownloadBytesDeadline func(dst []byte, url string, deadline time.Time) ([]byte, error)