Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type YoutubeApiHandler ¶
type YoutubeApiHandler struct {
ApiKey string // The Api Key used
Logger *log.Logger // Logger to write diagnostics to
// contains filtered or unexported fields
}
func New ¶
func New(apiKey string, logger *log.Logger) *YoutubeApiHandler
New creates a new YoutubeApiHandler and sets up the caching facilities
func (*YoutubeApiHandler) Close ¶
func (yt *YoutubeApiHandler) Close()
Close terminates the YoutubeApiHandler
func (*YoutubeApiHandler) GetRandomVid ¶
func (yt *YoutubeApiHandler) GetRandomVid(query string) (string, error)
GetRandomVid queries youtube and returns a random value from the results
func (*YoutubeApiHandler) MakeQuery ¶
func (yt *YoutubeApiHandler) MakeQuery(query string) YoutubeApiResponse
MakeQuery searches to see for results, it also uses Local Caching to reduce bandwidth/api use :)
type YoutubeApiResponse ¶
type YoutubeApiResponse struct {
Kind string `json:"kind"` // The Kind of response from the API
Etag string `json:"etag"` // The Etag of the video (for caching :) )
NextPageToken string `json:"nextPageToken"` // Token for next page
RegionCode string `json:"regionCode"` // The Region of the search
PageInfo YoutubePageInfo `json:"pageInfo"` // Info related to the query
Items []YoutubeVideoData `json:"items"` // The items returned
}
type YoutubePageInfo ¶
type YoutubeSearchCacheItem ¶
type YoutubeSearchCacheItem struct {
Date time.Time `json:"Date"`
Query string `json:"Query"`
Body YoutubeApiResponse `json:"Body"`
}
type YoutubeVideoData ¶
type YoutubeVideoData struct {
Kind string `json:"kind"` // type of content returned
Etag string `json:"etag"` // for replayability
Id YoutubeVideoId `json:"id"` // The information related directly to the video
Snippet YoutubeVideoSnippet `json:"snippet"` // The data related to the video I.E thumbs and shit
}
type YoutubeVideoId ¶
type YoutubeVideoSnippet ¶
type YoutubeVideoSnippet struct {
PublishedAt string `json:"publishedAt"` // UTC timestamp of time of video being published
ChannelId string `json:"channelId"` // The ID of the channel that uploaded the video
Title string `json:"title"` // The Title of the video uploaded
Description string `json:"string"` // The description of the video
Thumbnails map[string]YoutubeVideoThumbs `json:"thumbnails"` // Information related to the thumbnails of the videos
ChannelTitle string `json:"channelTitle"` // The name of the channel that uploaded the video
LiveBroadcastContent string `json:"liveBroadcastContent"` // Live broadcast content (I don't actually know what this means)
PublishTime string `json:"publishTime"` // The time the video was published
}
type YoutubeVideoThumbs ¶
Click to show internal directories.
Click to hide internal directories.