Documentation
¶
Index ¶
- type YoutubeAPI
- func (api YoutubeAPI) GetChannel(channelId string) (*channel.Item, error)
- func (api YoutubeAPI) GetChannelAllVideos(channelId string, custom map[string]string) ([]playlistitem.Item, error)
- func (api YoutubeAPI) GetChannelAllVideosPlaylist(channelId string) (*playlist.Item, error)
- func (api YoutubeAPI) GetChannelIdFromName(channelName string) (*string, error)
- func (api YoutubeAPI) GetChannelPlaylists(channelId string, customParameters map[string]string) ([]playlist.Item, *shared.Meta, error)
- func (api YoutubeAPI) GetChannelStats(channelId string) (*channel.Item, error)
- func (api YoutubeAPI) GetChannelStatsMany(channelIds []string) ([]channel.Item, error)
- func (api YoutubeAPI) GetChannels(channelIds []string) ([]channel.Item, error)
- func (api YoutubeAPI) GetPlaylist(playlistId string) (*playlist.Item, error)
- func (api YoutubeAPI) GetPlaylistVideoItems(plItemIds []string, customParameters map[string]string) ([]playlistitem.Item, error)
- func (api YoutubeAPI) GetPlaylistVideos(playlistId string, customParameters map[string]string) ([]playlistitem.Item, *shared.Meta, error)
- func (api YoutubeAPI) GetPlaylists(playlistIds []string) ([]playlist.Item, error)
- func (api YoutubeAPI) GetVideo(videoId string) (*video.Item, error)
- func (api YoutubeAPI) GetVideoStats(videoId string) (*video.Item, error)
- func (api YoutubeAPI) GetVideos(videoIds []string) ([]video.Item, error)
- func (api YoutubeAPI) GetVideosStats(videoIds []string) ([]video.Item, error)
- func (api YoutubeAPI) Search(query string, searchType search.TypeParam, customParameters map[string]string) (*search.Result, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type YoutubeAPI ¶
type YoutubeAPI struct {
// contains filtered or unexported fields
}
YoutubeAPI is REST client for YouTube REST API v3 See [internal](internal) directory for implementation details See https://console.cloud.google.com/apis/api/youtube.googleapis.com/quotas
func New ¶
func New(cl *http.Client, apikey string) *YoutubeAPI
New creates a new YouTube HTTP REST API v3 client
You can use caching in http.Client .Transport http.RoundTripper:
httpc := http.DefaultClient httpc.Transport = myCachingRoundTripper ytc := New(httpc, `...`)
func (YoutubeAPI) GetChannel ¶
func (api YoutubeAPI) GetChannel(channelId string) (*channel.Item, error)
GetChannel fetches channel information from YouTube REST API, see internal/channel for more details
func (YoutubeAPI) GetChannelAllVideos ¶ added in v1.5.0
func (api YoutubeAPI) GetChannelAllVideos(channelId string, custom map[string]string) ([]playlistitem.Item, error)
GetChannelAllVideos fetches all videos listed by given channelId
func (YoutubeAPI) GetChannelAllVideosPlaylist ¶ added in v1.5.0
func (api YoutubeAPI) GetChannelAllVideosPlaylist(channelId string) (*playlist.Item, error)
GetChannelAllVideosPlaylist fetches first channel information containing playlist ID and then fetches playlist meta information. Then you can iterate videos with GetPlaylistVideos()
func (YoutubeAPI) GetChannelIdFromName ¶ added in v1.4.0
func (api YoutubeAPI) GetChannelIdFromName(channelName string) (*string, error)
GetChannelIdFromName returns channel Id from given channel name (@foobarVideos) -> channel ID "abcdefgh". This might fail so try with Search(channelName, search.TypeChannel, ...) also
func (YoutubeAPI) GetChannelPlaylists ¶ added in v1.3.0
func (api YoutubeAPI) GetChannelPlaylists(channelId string, customParameters map[string]string) ([]playlist.Item, *shared.Meta, error)
GetChannelPlaylists fetches playlists meta information (no videos) from given channel ID
func (YoutubeAPI) GetChannelStats ¶ added in v1.3.0
func (api YoutubeAPI) GetChannelStats(channelId string) (*channel.Item, error)
GetChannelStats fetches statistics of given channel ID from YouTube REST API, see internal/channel for more details
func (YoutubeAPI) GetChannelStatsMany ¶ added in v1.3.0
func (api YoutubeAPI) GetChannelStatsMany(channelIds []string) ([]channel.Item, error)
GetChannelStatsMany fetches statistics of given channel ID(s) from YouTube REST API, see internal/channel for more details
func (YoutubeAPI) GetChannels ¶ added in v1.1.0
func (api YoutubeAPI) GetChannels(channelIds []string) ([]channel.Item, error)
GetChannels fetches multiple channel information from YouTube REST API, see internal/channel for more details
func (YoutubeAPI) GetPlaylist ¶ added in v1.2.0
func (api YoutubeAPI) GetPlaylist(playlistId string) (*playlist.Item, error)
GetPlaylist fetches given playlists' meta information (no videos)
func (YoutubeAPI) GetPlaylistVideoItems ¶ added in v1.3.0
func (api YoutubeAPI) GetPlaylistVideoItems(plItemIds []string, customParameters map[string]string) ([]playlistitem.Item, error)
GetPlaylistVideoItems fetches items (videos) which are *in* some playlist
func (YoutubeAPI) GetPlaylistVideos ¶ added in v1.3.0
func (api YoutubeAPI) GetPlaylistVideos(playlistId string, customParameters map[string]string) ([]playlistitem.Item, *shared.Meta, error)
GetPlaylistVideos fetches given playlists' videos
func (YoutubeAPI) GetPlaylists ¶ added in v1.3.0
func (api YoutubeAPI) GetPlaylists(playlistIds []string) ([]playlist.Item, error)
GetPlaylists fetches given list of playlists' meta information such as video count, but no videos
func (YoutubeAPI) GetVideo ¶
func (api YoutubeAPI) GetVideo(videoId string) (*video.Item, error)
GetVideo fetches video information from YouTube REST API, see internal/video for more details
func (YoutubeAPI) GetVideoStats ¶ added in v1.2.0
func (api YoutubeAPI) GetVideoStats(videoId string) (*video.Item, error)
GetVideoStats fetches video statistics from YouTube REST API, see internal/video for more details
func (YoutubeAPI) GetVideos ¶ added in v1.1.0
func (api YoutubeAPI) GetVideos(videoIds []string) ([]video.Item, error)
GetVideos fetches multiple video information from YouTube REST API, see internal/video for more details
func (YoutubeAPI) GetVideosStats ¶ added in v1.2.0
func (api YoutubeAPI) GetVideosStats(videoIds []string) ([]video.Item, error)
GetVideosStats fetches multiple video information from YouTube REST API, see internal/video for more details
func (YoutubeAPI) Search ¶
func (api YoutubeAPI) Search(query string, searchType search.TypeParam, customParameters map[string]string) (*search.Result, error)
Search searches YouTube REST API with given query, see internal/search for more details Note: the search consumes more API quota See https://developers.google.com/youtube/v3/docs/search/list