Documentation ¶
Index ¶
- Constants
- Variables
- func BrowseUrl(path, apiKey string) *url.URL
- func ChannelUrl(channelId string) *url.URL
- func PlayerUrl(path string) *url.URL
- func PlaylistId(ytUrlStr string) (string, error)
- func PlaylistUrl(playlistId string) *url.URL
- func SearchResultsUrl(terms ...string) *url.URL
- func ThumbnailUrl(videoId string, tq ThumbnailQuality) *url.URL
- func ThumbnailUrls(videoId string) []*url.URL
- func VideoId(ytUrlStr string) (string, error)
- func VideoUrl(videoId string) *url.URL
- type CaptionTrack
- type ChannelInitialData
- type ChannelMetadataRenderer
- type ChannelRenderer
- type ContinuationEndpoint
- type ContinuationItemRenderer
- type Format
- type Formats
- type GridChannelRenderer
- type GridPlaylistRenderer
- type GridVideoRenderer
- type InitialPlayerResponse
- func (ipr *InitialPlayerResponse) BestAdaptiveAudioFormat() *Format
- func (ipr *InitialPlayerResponse) BestAdaptiveVideoFormat() *Format
- func (ipr *InitialPlayerResponse) BestFormat() *Format
- func (ipr *InitialPlayerResponse) PublishDate() time.Time
- func (ipr *InitialPlayerResponse) SignatureCipher() bool
- func (ipr *InitialPlayerResponse) UploadDate() time.Time
- type ItemSectionRenderer
- type NavigationEndpoint
- type PlaylistHeaderRenderer
- type PlaylistInitialData
- func (pid *PlaylistInitialData) Continue(client *http.Client) error
- func (pid *PlaylistInitialData) HasContinuation() bool
- func (id *PlaylistInitialData) PlaylistContent() []PlaylistVideoListRendererContent
- func (id *PlaylistInitialData) PlaylistHeaderRenderer() *PlaylistHeaderRenderer
- func (id *PlaylistInitialData) PlaylistOwner() string
- func (id *PlaylistInitialData) SetContent(ct []PlaylistVideoListRendererContent)
- func (pid *PlaylistInitialData) Videos() []VideoIdTitleLengthChannel
- type PlaylistRenderer
- type PlaylistVideoListRendererContent
- type PlaylistVideoRenderer
- type Range
- type SearchInitialData
- type ShelfRenderer
- type SimpleText
- type Tab
- type Text
- type TextRuns
- type Thumbnail
- type ThumbnailQuality
- type VideoIdTitleLengthChannel
- type VideoRenderer
Constants ¶
View Source
const ( YoutubeHost = "youtube.com" DefaultVideoExt = mp4Ext DefaultThumbnailExt = jpegExt )
View Source
const (
StatusOK = "OK"
)
Variables ¶
View Source
var (
ErrMissingRequiredNode = errors.New("missing required node")
)
Functions ¶
func ChannelUrl ¶ added in v0.1.39
func PlaylistId ¶ added in v0.1.3
PlaylistId extracts playlist-id from a PlaylistUrl conforming URL
func PlaylistUrl ¶ added in v0.1.3
PlaylistUrl provides a URL for a playlist-id, e.g. http://www.youtube.com/playlist?list=playlist-id1 for "playlist-id1"
func SearchResultsUrl ¶ added in v0.1.36
SearchResultsUrl provides a URL for a set of search terms, e.g. http://www.youtube.com/results?search_query=some+terms
func ThumbnailUrl ¶ added in v0.1.14
func ThumbnailUrl(videoId string, tq ThumbnailQuality) *url.URL
func ThumbnailUrls ¶ added in v0.1.14
Types ¶
type CaptionTrack ¶ added in v0.1.30
type ChannelInitialData ¶ added in v0.1.39
type ChannelInitialData struct { Contents struct { TwoColumnBrowseResultsRenderer struct { Tabs []Tab `json:"tabs"` } `json:"twoColumnBrowseResultsRenderer"` } `json:"contents"` Metadata struct { ChannelMetadataRenderer ChannelMetadataRenderer `json:"channelMetadataRenderer"` } `json:"metadata"` Context *ytCfgInnerTubeContext }
func GetChannelPage ¶ added in v0.1.39
func GetChannelPage(client *http.Client, channelId string) (*ChannelInitialData, error)
func (*ChannelInitialData) ChannelMetadataRenderer ¶ added in v0.1.40
func (cid *ChannelInitialData) ChannelMetadataRenderer() *ChannelMetadataRenderer
func (*ChannelInitialData) Tabs ¶ added in v0.1.40
func (cid *ChannelInitialData) Tabs() []Tab
type ChannelMetadataRenderer ¶ added in v0.1.40
type ChannelMetadataRenderer struct { Title string `json:"title"` Description string `json:"description"` RSSUrl string `json:"rssUrl"` ExternalId string `json:"externalId"` Keywords string `json:"keywords"` OwnerUrls []string `json:"ownerUrls"` ChannelUrl string `json:"channelUrl"` IsFamilySafe bool `json:"isFamilySafe"` AvailableCountryCodes []string `json:"availableCountryCodes"` VanityChannelUrl string `json:"vanityChannelUrl"` }
type ChannelRenderer ¶ added in v0.1.36
type ChannelRenderer struct { ChannelId string `json:"channelId"` Title SimpleText `json:"title"` DescriptionSnippet TextRuns `json:"descriptionSnippet"` ShortBylineText TextRuns `json:"shortBylineText"` VideoCountText SimpleText `json:"videoCountText"` SubscriberCountText SimpleText `json:"subscriberCountText"` LongBylineText TextRuns `json:"longBylineText"` }
type ContinuationEndpoint ¶ added in v0.1.3
type ContinuationEndpoint struct { CommandMetadata struct { WebCommandMetadata struct { SendPost bool `json:"sendPost"` ApiUrl string `json:"apiUrl"` } `json:"webCommandMetadata"` } `json:"commandMetadata"` ContinuationCommand struct { Token string `json:"token"` Request string `json:"request"` } `json:"continuationCommand"` }
type ContinuationItemRenderer ¶ added in v0.1.3
type ContinuationItemRenderer struct { Trigger string `json:"trigger"` ContinuationEndpoint ContinuationEndpoint `json:"continuationEndpoint"` }
type Format ¶ added in v0.1.8
type Format struct { Url string `json:"url"` MIMEType string `json:"mimeType"` Bitrate int `json:"bitrate"` Width int `json:"width"` Height int `json:"height"` InitRange Range `json:"initRange"` IndexRange Range `json:"indexRange"` LastModified string `json:"lastModified"` ContentLength string `json:"contentLength"` Quality string `json:"quality"` FPS int `json:"fps"` QualityLabel string `json:"qualityLabel"` ProjectionType string `json:"projectionType"` AverageBitrate int `json:"averageBitrate"` HighReplication bool `json:"highReplication"` AudioQuality string `json:"audioQuality"` ApproxDurationMs string `json:"approxDurationMs"` AudioSampleRate string `json:"audioSampleRate"` AudioChannels int `json:"audioChannels"` LoudnessDb float64 `json:"loudnessDb"` SignatureCipher string `json:"signatureCipher"` // contains filtered or unexported fields }
Format captures stream data provided by YouTube
type Formats ¶ added in v0.1.8
type Formats []*Format
func (Formats) PreferredAudioFormats ¶ added in v0.1.42
func (Formats) PreferredVideoFormats ¶ added in v0.1.42
type GridChannelRenderer ¶ added in v0.1.39
type GridChannelRenderer struct { ChannelId string `json:"channelId"` VideoCountText TextRuns `json:"videoCountText"` SubscriberCountText SimpleText `json:"subscriberCountText"` Title SimpleText `json:"title"` }
type GridPlaylistRenderer ¶ added in v0.1.39
type GridPlaylistRenderer struct { PlaylistId string `json:"playlistId"` Title SimpleText `json:"title"` VideoCountText TextRuns `json:"videoCountText"` VideoCountShortText SimpleText `json:"videoCountShortText"` ViewPlaylistText TextRuns `json:"viewPlaylistText"` PublishedTimeText SimpleText `json:"publishedTimeText,omitempty"` }
type GridVideoRenderer ¶ added in v0.1.39
type GridVideoRenderer struct { VideoId string `json:"videoId"` Title SimpleText `json:"title"` PublishedTimeText SimpleText `json:"publishedTimeText"` ViewCountText SimpleText `json:"viewCountText"` ShortViewCountText SimpleText `json:"shortViewCountText"` ShortBylineText TextRuns `json:"shortBylineText,omitempty"` }
type InitialPlayerResponse ¶ added in v0.1.3
type InitialPlayerResponse struct { PlayerUrl string PlayabilityStatus struct { Status string `json:"status"` Reason string `json:"reason"` ErrorScreen struct { PlayerErrorMessageRenderer struct { SubReason SimpleText `json:"subreason"` } `json:"playerErrorMessageRenderer"` } `json:"errorScreen"` } `json:"playabilityStatus"` StreamingData struct { ExpiresInSeconds string `json:"expiresInSeconds"` Formats Formats `json:"formats"` AdaptiveFormats Formats `json:"adaptiveFormats"` HLSManifestUrl string `json:"hlsManifestUrl"` } `json:"streamingData"` VideoDetails struct { VideoId string `json:"videoId"` Title string `json:"title"` LengthSeconds string `json:"lengthSeconds"` Keywords []string `json:"keywords"` ChannelId string `json:"channelId"` ShortDescription string `json:"shortDescription"` Thumbnail struct { Thumbnails []Thumbnail `json:"thumbnails"` } `json:"thumbnail"` ViewCount string `json:"viewCount"` Author string `json:"author"` IsPrivate bool `json:"isPrivate"` } `json:"videoDetails"` Microformat struct { PlayerMicroformatRenderer struct { Thumbnail struct { Thumbnails []Thumbnail `json:"thumbnails"` } `json:"thumbnail"` Title SimpleText `json:"title"` Description SimpleText `json:"description"` OwnerProfileUrl string `json:"ownerProfileUrl"` OwnerChannelName string `json:"ownerChannelName"` ExternalChannelId string `json:"externalChannelId"` IsFamilySafe bool `json:"IsFamilySafe"` AvailableCountries []string `json:"availableCountries"` IsUnlisted bool `json:"isUnlisted"` ViewCount string `json:"viewCount"` Category string `json:"category"` PublishDate string `json:"publishDate"` UploadDate string `json:"uploadDate"` } `json:"playerMicroformatRenderer"` } `json:"microformat"` Captions struct { PlayerCaptionsTracklistRenderer struct { CaptionTracks []CaptionTrack `json:"captionTracks"` AudioTracks []struct { CaptionTrackIndices []int `json:"captionTrackIndices"` } `json:"audioTracks"` TranslationLanguages []struct { LanguageCode string `json:"languageCode"` LanguageName SimpleText `json:"languageName"` } `json:"translationLanguages"` DefaultAudioTrackIndex int `json:"defaultAudioTrackIndex"` } `json:"playerCaptionsTracklistRenderer"` } `json:"captions"` }
InitialPlayerResponse is a minimal set of data structures required to decode and extract streaming data formats for video URL ytInitialPlayerResponse
func GetVideoPage ¶ added in v0.1.3
func GetVideoPage(client *http.Client, videoId string) (*InitialPlayerResponse, error)
func (*InitialPlayerResponse) BestAdaptiveAudioFormat ¶ added in v0.1.42
func (ipr *InitialPlayerResponse) BestAdaptiveAudioFormat() *Format
func (*InitialPlayerResponse) BestAdaptiveVideoFormat ¶ added in v0.1.42
func (ipr *InitialPlayerResponse) BestAdaptiveVideoFormat() *Format
func (*InitialPlayerResponse) BestFormat ¶ added in v0.1.42
func (ipr *InitialPlayerResponse) BestFormat() *Format
func (*InitialPlayerResponse) PublishDate ¶ added in v0.1.3
func (ipr *InitialPlayerResponse) PublishDate() time.Time
func (*InitialPlayerResponse) SignatureCipher ¶ added in v0.1.46
func (ipr *InitialPlayerResponse) SignatureCipher() bool
func (*InitialPlayerResponse) UploadDate ¶ added in v0.1.3
func (ipr *InitialPlayerResponse) UploadDate() time.Time
type ItemSectionRenderer ¶ added in v0.1.39
type ItemSectionRenderer struct { Contents []struct { ShelfRenderer ShelfRenderer `json:"shelfRenderer,omitempty"` } `json:"contents"` }
type NavigationEndpoint ¶ added in v0.1.36
type NavigationEndpoint struct { string `json:"url"` WebPageType string `json:"webPageType"` RootVe int `json:"rootVe"` ApiUrl string `json:"apiUrl"` } `json:"webCommandMetadata"` } `json:"commandMetadata"` BrowseId string `json:"browseId"` CanonicalBaseUrl string `json:"canonicalBaseUrl"` } `json:"browseEndpoint"` VideoId string `json:"videoId"` PlaylistId string `json:"playlistId"` } }WebCommandMetadata struct { Url
type PlaylistHeaderRenderer ¶ added in v0.1.29
type PlaylistHeaderRenderer struct { PlaylistId string `json:"playlistId"` Title SimpleText `json:"title"` DescriptionText SimpleText `json:"descriptionText"` OwnerText TextRuns `json:"ownerText"` ViewCountText SimpleText `json:"viewCountText"` Privacy string `json:"privacy"` }
type PlaylistInitialData ¶ added in v0.1.29
type PlaylistInitialData struct { Contents struct { TwoColumnBrowseResultsRenderer struct { Tabs []struct { TabRenderer struct { Content struct { SectionListRenderer struct { Contents []struct { ItemSectionRenderer struct { Contents []struct { PlaylistVideoListRenderer struct { PlaylistId string `json:"playlistId"` Contents []PlaylistVideoListRendererContent `json:"contents"` } `json:"playlistVideoListRenderer"` } `json:"contents"` } `json:"itemSectionRenderer"` } `json:"contents"` } `json:"sectionListRenderer"` } `json:"content"` } `json:"tabRenderer"` } `json:"tabs"` } `json:"twoColumnBrowseResultsRenderer"` } `json:"contents"` Header struct { PlaylistHeaderRenderer PlaylistHeaderRenderer `json:"playlistHeaderRenderer"` } `json:"header"` Context *ytCfgInnerTubeContext // contains filtered or unexported fields }
PlaylistInitialData is a minimal set of data structures required to decode and extract videoIds for playlist URL ytInitialData
func GetPlaylistPage ¶ added in v0.1.3
func GetPlaylistPage(client *http.Client, playlistId string) (*PlaylistInitialData, error)
func (*PlaylistInitialData) Continue ¶ added in v0.1.36
func (pid *PlaylistInitialData) Continue(client *http.Client) error
func (*PlaylistInitialData) HasContinuation ¶ added in v0.1.36
func (pid *PlaylistInitialData) HasContinuation() bool
func (*PlaylistInitialData) PlaylistContent ¶ added in v0.1.32
func (id *PlaylistInitialData) PlaylistContent() []PlaylistVideoListRendererContent
func (*PlaylistInitialData) PlaylistHeaderRenderer ¶ added in v0.1.40
func (id *PlaylistInitialData) PlaylistHeaderRenderer() *PlaylistHeaderRenderer
func (*PlaylistInitialData) PlaylistOwner ¶ added in v0.1.32
func (id *PlaylistInitialData) PlaylistOwner() string
func (*PlaylistInitialData) SetContent ¶ added in v0.1.32
func (id *PlaylistInitialData) SetContent(ct []PlaylistVideoListRendererContent)
func (*PlaylistInitialData) Videos ¶ added in v0.1.36
func (pid *PlaylistInitialData) Videos() []VideoIdTitleLengthChannel
type PlaylistRenderer ¶ added in v0.1.36
type PlaylistRenderer struct { PlaylistId string `json:"playlistId"` Title SimpleText `json:"title"` VideoCount string `json:"videoCount"` ViewPlaylistText TextRuns `json:"viewPlaylistText"` ShortBylineText TextRuns `json:"shortBylineText"` Videos []struct { ChildVideoRenderer struct { Title SimpleText `json:"title"` NavigationEndpoint NavigationEndpoint `json:"navigationEndpoint"` LengthText SimpleText `json:"lengthText"` VideoId string `json:"videoId"` } `json:"childVideoRenderer"` } `json:"videos"` VideoCountText TextRuns `json:"videoCountText"` TrackingParams string `json:"trackingParams"` ThumbnailText TextRuns `json:"thumbnailText"` LongBylineText TextRuns `json:"longBylineText"` }
type PlaylistVideoListRendererContent ¶ added in v0.1.3
type PlaylistVideoListRendererContent struct { PlaylistVideoRenderer PlaylistVideoRenderer ContinuationItemRenderer ContinuationItemRenderer }
type PlaylistVideoRenderer ¶ added in v0.1.3
type SearchInitialData ¶ added in v0.1.36
type SearchInitialData struct { EstimatedResults string `json:"estimatedResults"` Contents struct { TwoColumnSearchResultsRenderer struct { PrimaryContents struct { SectionListRenderer struct { Contents []struct { ItemSectionRenderer struct { Contents []struct { ChannelRenderer ChannelRenderer `json:"channelRenderer,omitempty"` PlaylistRenderer PlaylistRenderer `json:"playlistRenderer,omitempty"` VideoRenderer VideoRenderer `json:"videoRenderer,omitempty"` } `json:"contents"` } `json:"itemSectionRenderer,omitempty"` ContinuationItemRenderer ContinuationItemRenderer `json:"continuationItemRenderer,omitempty"` } `json:"contents"` } `json:"sectionListRenderer"` } `json:"primaryContents"` } `json:"twoColumnSearchResultsRenderer"` } `json:"contents"` Refinements []string `json:"refinements"` Context *ytCfgInnerTubeContext }
func GetSearchResultsPage ¶ added in v0.1.36
func GetSearchResultsPage(client *http.Client, terms ...string) (*SearchInitialData, error)
func (*SearchInitialData) ChannelRenderers ¶ added in v0.1.37
func (sid *SearchInitialData) ChannelRenderers() []ChannelRenderer
func (*SearchInitialData) PlaylistRenderers ¶ added in v0.1.37
func (sid *SearchInitialData) PlaylistRenderers() []PlaylistRenderer
func (*SearchInitialData) VideoRenderers ¶ added in v0.1.37
func (sid *SearchInitialData) VideoRenderers() []VideoRenderer
type ShelfRenderer ¶ added in v0.1.40
type ShelfRenderer struct { Title TextRuns `json:"title"` Content struct { HorizontalListRenderer struct { Items []struct { GridVideoRenderer GridVideoRenderer `json:"gridVideoRenderer,omitempty"` GridPlaylistRenderer GridPlaylistRenderer `json:"gridPlaylistRenderer,omitempty"` GridChannelRenderer GridChannelRenderer `json:"gridChannelRenderer,omitempty"` } `json:"items"` } `json:"horizontalListRenderer"` } `json:"content"` PlayAllButton struct { ButtonRenderer struct { Style string `json:"style"` Size string `json:"size"` IsDisabled bool `json:"isDisabled"` Text struct { Runs []struct { Text string `json:"text"` } `json:"runs"` } `json:"text"` Icon struct { IconType string `json:"iconType"` } `json:"icon"` NavigationEndpoint NavigationEndpoint `json:"navigationEndpoint"` } `json:"buttonRenderer"` } `json:"playAllButton"` }
func (*ShelfRenderer) GridVideoRenderers ¶ added in v0.1.40
func (sr *ShelfRenderer) GridVideoRenderers() []GridVideoRenderer
func (*ShelfRenderer) PlaylistId ¶ added in v0.1.40
func (sr *ShelfRenderer) PlaylistId() string
type SimpleText ¶ added in v0.1.26
type SimpleText struct {
SimpleText string `json:"simpleText"`
}
type Tab ¶ added in v0.1.40
type Tab struct { TabRenderer struct { Content struct { SectionListRenderer struct { Contents []struct { ItemSectionRenderer ItemSectionRenderer `json:"itemSectionRenderer"` } `json:"contents"` } `json:"sectionListRenderer"` } `json:"content,omitempty"` } `json:"tabRenderer,omitempty"` }
func (*Tab) Sections ¶ added in v0.1.40
func (tab *Tab) Sections() []ShelfRenderer
type TextRuns ¶ added in v0.1.37
type ThumbnailQuality ¶ added in v0.1.14
type ThumbnailQuality int
const ( ThumbnailQualityUnknown ThumbnailQuality = iota ThumbnailQualitySD ThumbnailQualityMQ ThumbnailQualityHQ ThumbnailQualityMaxRes )
func AllThumbnailQualities ¶ added in v0.1.34
func AllThumbnailQualities() []ThumbnailQuality
func LowerQuality ¶ added in v0.1.41
func LowerQuality(q ThumbnailQuality) ThumbnailQuality
func ParseThumbnailQuality ¶ added in v0.1.35
func ParseThumbnailQuality(tqs string) ThumbnailQuality
func (ThumbnailQuality) String ¶ added in v0.1.33
func (tq ThumbnailQuality) String() string
type VideoIdTitleLengthChannel ¶ added in v0.1.45
type VideoRenderer ¶ added in v0.1.36
type VideoRenderer struct { VideoId string `json:"videoId"` Title TextRuns `json:"title"` LongBylineText TextRuns `json:"longBylineText"` PublishedTimeText SimpleText `json:"publishedTimeText"` LengthText SimpleText `json:"lengthText"` ViewCountText SimpleText `json:"viewCountText"` OwnerText TextRuns `json:"ownerText"` ShortBylineText TextRuns `json:"shortBylineText"` ShortViewCountText SimpleText `json:"shortViewCountText"` IsWatched bool `json:"isWatched,omitempty"` }
Source Files ¶
- browse_url.go
- channel_initial_data.go
- channel_page.go
- channel_url.go
- extract_json_object.go
- formats.go
- initial_player_response.go
- player_url.go
- playlist_initial_data.go
- playlist_page.go
- playlist_url.go
- search_initial_data.go
- search_results_page.go
- search_results_url.go
- thumbnail_quality.go
- thumbnail_url.go
- url_consts.go
- video_page.go
- video_url.go
- ytcfg.go
Click to show internal directories.
Click to hide internal directories.