Documentation ¶
Index ¶
- Variables
- type 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
- type 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
- type Format
- type Formats
- type ITag
- type ListItem
- type Player
- 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)
- type PlaylistResult
- 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
- type StreamID
- type Streams
- 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
- type Transport
Constants ¶
This section is empty.
Variables ¶
View Source
var ( RegexWatchPlayerConfig = regexp.MustCompile(`ytplayer\.config = ({(?:"\w+":(?:.*?))*});`) RegexEmbedPlayerConfig = regexp.MustCompile(`yt\.setConfig\({'PLAYER_CONFIG': (.*?)}\)`) )
View Source
var AudioQuality = map[string]int{
"AUDIO_QUALITY_LOW": 0,
"AUDIO_QUALITY_MEDIUM": 1,
"AUDIO_QUALITY_HIGH": 2,
}
View Source
var ITags = [...]ITag{
5: {
Extension: "flv",
Resolution: "240p",
VideoEncoding: "Sorenson H.283",
AudioEncoding: "mp3",
AudioBitrate: 64,
},
6: {
Extension: "flv",
Resolution: "270p",
VideoEncoding: "Sorenson H.263",
AudioEncoding: "mp3",
AudioBitrate: 64,
},
13: {
Extension: "3gp",
VideoEncoding: "MPEG-4 Visual",
AudioEncoding: "aac",
},
17: {
Extension: "3gp",
Resolution: "144p",
VideoEncoding: "MPEG-4 Visual",
AudioEncoding: "aac",
AudioBitrate: 24,
},
18: {
Extension: "mp4",
Resolution: "360p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 96,
},
22: {
Extension: "mp4",
Resolution: "720p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 192,
},
34: {
Extension: "flv",
Resolution: "480p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 128,
},
35: {
Extension: "flv",
Resolution: "360p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 128,
},
36: {
Extension: "3gp",
Resolution: "240p",
VideoEncoding: "MPEG-4 Visual",
AudioEncoding: "aac",
AudioBitrate: 36,
},
37: {
Extension: "mp4",
Resolution: "1080p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 192,
},
38: {
Extension: "mp4",
Resolution: "3072p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 192,
},
43: {
Extension: "webm",
Resolution: "360p",
VideoEncoding: "VP8",
AudioEncoding: "vorbis",
AudioBitrate: 128,
},
44: {
Extension: "webm",
Resolution: "480p",
VideoEncoding: "VP8",
AudioEncoding: "vorbis",
AudioBitrate: 128,
},
45: {
Extension: "webm",
Resolution: "720p",
VideoEncoding: "VP8",
AudioEncoding: "vorbis",
AudioBitrate: 192,
},
46: {
Extension: "webm",
Resolution: "1080p",
VideoEncoding: "VP8",
AudioEncoding: "vorbis",
AudioBitrate: 192,
},
82: {
Extension: "mp4",
Resolution: "360p",
VideoEncoding: "H.264",
AudioBitrate: 96,
},
83: {
Extension: "mp4",
Resolution: "240p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 96,
},
84: {
Extension: "mp4",
Resolution: "720p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 192,
},
85: {
Extension: "mp4",
Resolution: "1080p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 192,
},
100: {
Extension: "webm",
Resolution: "360p",
VideoEncoding: "VP8",
AudioEncoding: "vorbis",
AudioBitrate: 128,
},
101: {
Extension: "webm",
Resolution: "360p",
VideoEncoding: "VP8",
AudioEncoding: "vorbis",
AudioBitrate: 192,
},
102: {
Extension: "webm",
Resolution: "720p",
VideoEncoding: "VP8",
AudioEncoding: "vorbis",
AudioBitrate: 192,
},
133: {
Extension: "mp4",
Resolution: "240p",
VideoEncoding: "H.264",
},
134: {
Extension: "mp4",
Resolution: "360p",
VideoEncoding: "H.264",
},
135: {
Extension: "mp4",
Resolution: "480p",
VideoEncoding: "H.264",
},
136: {
Extension: "mp4",
Resolution: "720p",
VideoEncoding: "H.264",
},
137: {
Extension: "mp4",
Resolution: "1080p",
VideoEncoding: "H.264",
},
138: {
Extension: "mp4",
Resolution: "2160p",
VideoEncoding: "H.264",
},
160: {
Extension: "mp4",
Resolution: "144p",
VideoEncoding: "H.264",
},
242: {
Extension: "webm",
Resolution: "240p",
VideoEncoding: "VP9",
},
243: {
Extension: "webm",
Resolution: "360p",
VideoEncoding: "VP9",
},
244: {
Extension: "webm",
Resolution: "480p",
VideoEncoding: "VP9",
},
247: {
Extension: "webm",
Resolution: "720p",
VideoEncoding: "VP9",
},
248: {
Extension: "webm",
Resolution: "1080p",
VideoEncoding: "VP9",
AudioBitrate: 9,
},
264: {
Extension: "mp4",
Resolution: "1440p",
VideoEncoding: "H.264",
},
266: {
Extension: "mp4",
Resolution: "2160p",
VideoEncoding: "H.264",
},
271: {
Extension: "webm",
Resolution: "1440p",
VideoEncoding: "VP9",
},
272: {
Extension: "webm",
Resolution: "2160p",
VideoEncoding: "VP9",
},
278: {
Extension: "webm",
Resolution: "144p",
VideoEncoding: "VP9",
},
298: {
Extension: "mp4",
Resolution: "720p",
VideoEncoding: "H.264",
FPS: 60,
},
299: {
Extension: "mp4",
Resolution: "1080p",
VideoEncoding: "H.264",
FPS: 60,
},
302: {
Extension: "webm",
Resolution: "720p",
VideoEncoding: "VP9",
FPS: 60,
},
303: {
Extension: "webm",
Resolution: "1080p",
VideoEncoding: "VP9",
FPS: 60,
},
308: {
Extension: "webm",
Resolution: "1440p",
VideoEncoding: "VP9",
FPS: 60,
},
313: {
Extension: "webm",
Resolution: "2160p",
VideoEncoding: "VP9",
},
315: {
Extension: "webm",
Resolution: "2160p",
VideoEncoding: "VP9",
FPS: 60,
},
139: {
Extension: "mp4",
AudioEncoding: "aac",
AudioBitrate: 48,
},
140: {
Extension: "mp4",
AudioEncoding: "aac",
AudioBitrate: 128,
},
141: {
Extension: "mp4",
AudioEncoding: "aac",
AudioBitrate: 256,
},
171: {
Extension: "webm",
AudioEncoding: "vorbis",
AudioBitrate: 128,
},
172: {
Extension: "webm",
AudioEncoding: "vorbis",
AudioBitrate: 192,
},
249: {
Extension: "webm",
AudioEncoding: "opus",
AudioBitrate: 50,
},
250: {
Extension: "webm",
AudioEncoding: "opus",
AudioBitrate: 70,
},
251: {
Extension: "webm",
AudioEncoding: "opus",
AudioBitrate: 160,
},
92: {
Extension: "ts",
Resolution: "240p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 48,
},
93: {
Extension: "ts",
Resolution: "480p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 128,
},
94: {
Extension: "ts",
Resolution: "720p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 128,
},
95: {
Extension: "ts",
Resolution: "1080p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 256,
},
96: {
Extension: "ts",
Resolution: "720p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 256,
},
120: {
Extension: "flv",
Resolution: "720p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 128,
},
127: {
Extension: "ts",
AudioEncoding: "aac",
AudioBitrate: 96,
},
128: {
Extension: "ts",
AudioEncoding: "aac",
AudioBitrate: 96,
},
132: {
Extension: "ts",
Resolution: "240p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 48,
},
151: {
Extension: "ts",
Resolution: "720p",
VideoEncoding: "H.264",
AudioEncoding: "aac",
AudioBitrate: 24,
},
394: {
Extension: "mp4",
Resolution: "144p",
VideoEncoding: "AV1",
},
395: {
Extension: "mp4",
Resolution: "240p",
VideoEncoding: "AV1",
},
396: {
Extension: "mp4",
Resolution: "360p",
VideoEncoding: "AV1",
},
397: {
Extension: "mp4",
Resolution: "480p",
VideoEncoding: "AV1",
},
398: {
Extension: "mp4",
Resolution: "720p",
VideoEncoding: "AV1",
},
399: {
Extension: "mp4",
Resolution: "1080p",
VideoEncoding: "AV1",
},
400: {
Extension: "mp4",
Resolution: "1440p",
VideoEncoding: "AV1",
},
401: {
Extension: "mp4",
Resolution: "2160p",
VideoEncoding: "AV1",
},
402: {
Extension: "mp4",
Resolution: "2880p",
VideoEncoding: "AV1",
},
}
View Source
var RegexStreamID = regexp.MustCompile(`(?i)([a-z0-9_-]{11})`)
View Source
var VideoQuality = map[string]int{
"tiny": 0,
"low": 1,
"medium": 2,
"large": 3,
"hd1440": 4,
"hd2160": 5,
}
Functions ¶
This section is empty.
Types ¶
type Assets ¶
func LoadEmbedPlayerAssets ¶
func ParseAssetsJSON ¶
func (Assets) LoadCSSDeadline ¶
func (Assets) LoadCSSTimeout ¶
func (Assets) LoadJSDeadline ¶
type Cipher ¶
type Cipher struct { URL string `json:"url"` Signature string `json:"s"` SignaturePolicy string `json:"sp"` }
func ParseCipherJSON ¶
type Client ¶
type Client struct {
Transport
}
func WrapClient ¶
func (*Client) LoadDeadline ¶
func (*Client) LoadEmbedPlayerAssets ¶
func (*Client) LoadEmbedPlayerAssetsDeadline ¶
func (*Client) LoadEmbedPlayerAssetsTimeout ¶
func (*Client) LoadEmbedPlayerDeadline ¶
func (*Client) LoadEmbedPlayerStreams ¶
func (*Client) LoadEmbedPlayerStreamsDeadline ¶
func (*Client) LoadEmbedPlayerStreamsTimeout ¶
func (*Client) LoadEmbedPlayerTimeout ¶
func (*Client) LoadPlaylist ¶
func (c *Client) LoadPlaylist(id string, offset uint) (PlaylistResult, error)
func (*Client) LoadPlaylistDeadline ¶
func (*Client) LoadPlaylistTimeout ¶
func (*Client) LoadTimeout ¶
func (*Client) LoadWatchPlayerDeadline ¶
func (*Client) LoadWatchPlayerTimeout ¶
func (*Client) SearchDeadline ¶
func (*Client) SearchTimeout ¶
type ColorInfo ¶
type ColorInfo struct { Primaries string `json:"primaries"` TransferCharacteristics string `json:"transferCharacteristics"` MatrixCoefficients string `json:"matrixCoefficients"` }
func ParseColorInfoJSON ¶
type Format ¶
type Format struct { AverageBitrate uint `json:"averageBitrate"` ApproxDurationMs string `json:"approxDurationMs"` ContentLength string `json:"contentLength"` Bitrate uint `json:"bitrate"` URL *string `json:"url,omitempty"` Cipher *Cipher `json:"cipher,omitempty"` Quality string `json:"quality"` QualityLabel string `json:"qualityLabel"` ITag uint `json:"itag"` MIMEType string `json:"mimeType"` Width uint `json:"width"` Height uint `json:"height"` FPS *uint `json:"fps,omitempty"` ColorInfo *ColorInfo `json:"colorInfo,omitempty"` AudioQuality *string `json:"audioQuality,omitempty"` AudioChannels *uint `json:"audioChannels,omitempty"` AudioSampleRate *string `json:"audioSampleRate,omitempty"` InitRange *TimeRange `json:"initRange,omitempty"` IndexRange *TimeRange `json:"indexRange,omitempty"` LastModified string `json:"lastModified"` HighReplication bool `json:"highReplication,omitempty"` ProjectionType string `json:"projectionType"` }
func ParseFormatJSON ¶
func (Format) FileExtension ¶
type Formats ¶
type Formats []Format
func FilterAudioStreams ¶
func FilterVideoStreams ¶
func SortByAudioQuality ¶
func SortByVideoQuality ¶
func (Formats) SortByAudioQuality ¶
func (Formats) SortByVideoQuality ¶
type ListItem ¶
type ListItem struct { ID StreamID `json:"encrypted_id"` Title string `json:"title"` Description string `json:"description"` Thumbnail string `json:"thumbnail"` Added string `json:"added"` TimeCreated time.Time `json:"time_created"` Rating float64 `json:"rating"` Likes uint `json:"likes"` Dislikes uint `json:"dislikes"` Views string `json:"views"` Comments string `json:"comments"` Duration string `json:"duration"` LengthSeconds time.Duration `json:"length_seconds"` Author string `json:"author"` UserID string `json:"user_id"` Privacy string `json:"privacy"` CategoryID uint `json:"category_id"` IsHD bool `json:"is_hd"` IsCC bool `json:"is_cc"` CCLicense bool `json:"cc_license"` Keywords []string `json:"keywords"` }
func ParseListItem ¶
type Player ¶
func LoadEmbedPlayer ¶
func LoadEmbedPlayerDeadline ¶
func LoadEmbedPlayerTimeout ¶
func LoadWatchPlayer ¶
func LoadWatchPlayerDeadline ¶
func LoadWatchPlayerTimeout ¶
func (Player) ResolveURLDeadline ¶
type PlaylistResult ¶
type PlaylistResult struct { Title string `json:"title"` Author string `json:"author"` Description string `json:"description"` Views uint `json:"views"` Items []ListItem `json:"video"` }
func LoadPlaylist ¶
func LoadPlaylist(id string, offset uint) (PlaylistResult, error)
func LoadPlaylistDeadline ¶
func LoadPlaylistTimeout ¶
func ParsePlaylistResultJSON ¶
func ParsePlaylistResultJSON(v *fastjson.Value) PlaylistResult
type SearchResult ¶
func ParseSearchResultJSON ¶
func ParseSearchResultJSON(v *fastjson.Value) SearchResult
func SearchDeadline ¶
func SearchTimeout ¶
type Streams ¶
type Streams struct {
// contains filtered or unexported fields
}
func LoadEmbedPlayerStreams ¶
func (Streams) AverageRating ¶
func (Streams) ContextParams ¶
func (Streams) ExpiresInSeconds ¶
func (Streams) MuxedFormats ¶
MuxedFormats returns premuxed (video/audio-combined) streaming formats. Premuxing comes at an expense of poorer video/audio quality.
func (Streams) PlayableInEmbed ¶
func (Streams) ShortDescription ¶
func (Streams) SourceFormats ¶
SourceFormats returns streaming formats that either video-only or audio-only at their highest quality. See the documentation for MuxedFormats for lower quality, premuxed streaming formats..
type TimeRange ¶
func ParseTimeRangeJSON ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.