Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶ added in v1.0.0
type Channel struct {
ID string `json:"uploader_id"` // The channel ID.
URL string `json:"uploader_url"` // The channel URL.
Name string `json:"uploader"` // The channel name.
}
This holds basic information about a channel.
type GoTubeClient ¶ added in v1.0.0
Use this structs methods to extract video/playlist data.
func New ¶
func New(youtubeDlPath string, customArgs []string) *GoTubeClient
This is a constructor for 'GoTubeClient'. Here you can set the path to the youtube-dl binary and custom arguments. Use this structs methods to extract video/playlist data. Returns a new 'SGoTube' struct.
func (*GoTubeClient) NewPlaylist ¶ added in v1.0.0
func (gtc *GoTubeClient) NewPlaylist(url string, extractParallel bool) (*Playlist, error)
Extracts playlist information from given playlist URL. Returns a new 'Playlist' struct and any errors encountered.
type Playlist ¶ added in v1.0.0
type Playlist struct {
ID string `json:"playlist_id"` // The playlist ID.
Title string `json:"playlist_title"` // The playlist title.
Uploader *Channel `json:""` // The uploader of the playlist.
Videos Videos `json:"entries"` // The videos in the playlist.
}
This holds basic information about a playlist.
type Stream ¶ added in v1.0.0
type Stream struct {
URL string `json:"url"` // The URL of the stream.
Extension string `json:"ext"` // The file extension of the stream.
FileSize int `json:"filesize"` // The file size of the stream.
ASR float32 `json:"asr"` // The audio sample rate used.
TBR float32 `json:"tbr"` // I don't know. But it's there and sure useful for someone.
VBR float32 `json:"vbr"` // The video bit rate used.
Quality int `json:"quality"` // The quality of the stream. This corresponds to the quality setting when watching youtube videos.
ACodec string `json:"acodec"` // The audio codec used.
VCodec string `json:"vcodec"` // The video codec used.
Height int `json:"height"` // The height of the video.
Width int `json:"width"` // The width of the video.
FPS float32 `json:"fps"` // The frames per second of the video.
FormatID string `json:"format_id"` // The Format ID of the stream. See https://gist.github.com/AgentOak/34d47c65b1d28829bb17c24c04a0096f for more.
FormatNote string `json:"format_note"` // The format note of the stream.
}
This holds all important (and not so important) information about a video stream.
func (*Stream) Download ¶ added in v1.0.0
Downloads the stream file to the specified Path\File. File extension is automatically added. File is overwritten if it already exists. Returns any errors encountered.
type Streams ¶ added in v1.0.0
type Streams []*Stream
type Thumbnail ¶ added in v1.0.0
type Thumbnail struct {
ID int `json:"id"` // The thumbnail ID.
URL string `json:"url"` // The thumbnail URL.
Height int `json:"height"` // The thumbnail height.
Width int `json:"width"` // The thumbnail width.
}
This holds all information about a thumbnail.
type Thumbnails ¶ added in v1.0.0
type Thumbnails []*Thumbnail
func (Thumbnails) Filtered ¶ added in v1.0.0
func (t Thumbnails) Filtered(predicate func(t *Thumbnail) bool) Thumbnails
Returns a list of thumbnails that match the specified filter function. It does not modify the original list.
func (Thumbnails) OrderedBy ¶ added in v1.0.0
func (t Thumbnails) OrderedBy(property string) Thumbnails
Returns a list of thumbnails sorted by the specified property. It does not modify the original list. It panics if the property is not found.
type Video ¶ added in v1.0.0
type Video struct {
ID string `json:"id"` // The video ID.
URL string `json:"webpage_url"` // The video URL.
Title string `json:"title"` // The video title.
AltTitle string `json:"alt_title"` // The video alternative title.
Description string `json:"description"` // The video description.
Tags []string `json:"tags"` // The video tags.
ViewCount int `json:"view_count"` // The number of views.
LikeCount int `json:"like_count"` // The number of likes.
Duration float32 `json:"duration"` // The video duration in seconds.
UploadDate string `json:"upload_date"` // The upload date in unix time.
AgeLimit int `json:"age_limit"` // The age limit of the video.
IsLive bool `json:"is_live"` // If the video is live.
PlaylistIndex int `json:"playlist_index"` // The index of the video in the playlist.
Uploader *Channel `json:""` // The uploader of the video.
Thumbnails Thumbnails `json:"thumbnails"` // The thumbnails of the video.
Streams Streams `json:"formats"` // The streams of the video.
}
This holds all important information about a video.
func (*Video) IsAgeRestricted ¶ added in v1.0.0
Returns true if the video is age restricted.