/youtubeapi

YouTube REST API client for Go

Primary LanguageGoApache License 2.0Apache-2.0

youtubeapi

GitHub release (latest by date) GitHub tag (latest by date) Go Report Card

YouTube REST API v3 client for Go. For searching and getting details of YouTube videos, channels and playlists.

Currently implemented

  • Video details
  • Channel details
  • Search
  • Playlists

Example

yt := youtubeapi.New(httpc, apiKey)
item, err := yt.GetVideo(`dQw4w9WgXcQ`)
if err != nil {
	panic(err)
}

fmt.Printf(`%v %v %v`, item.Snippet.ChannelID, item.Snippet.PublishedAt, item.Snippet.Title)

ch, err := yt.GetChannel(`UCuAXFkgsw1L7xaCfnd5JJOw`)
if err != nil {
	panic(err)
}

fmt.Printf(`%v %v %v`, ch.Snippet.PublishedAt, ch.Snippet.Title, ch.Snippet.Description)

custom := map[string]string{
	`regionCode`:        `US`,
	`relevanceLanguage`: `en`,
}

res, err := yt.Search(`never gonna give you up`, custom)
if err != nil {
	panic(err)
}

fmt.Printf(`%v`, res)

References