youtube

package
v4.1.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2021 License: BSD-1-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package youtube provides a minimal set of bindings for Youtube's Data API v3.

This package requires a valid API key to be specified. You can get one from your Google account's developer console. See:

https://console.developers.google.com/apis

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSuchVideo   = errors.New("no such video")
	ErrInvalidAPIKey = errors.New("invalid or missing API key")
	ErrInvalidID     = errors.New("invalid or missing video ID")
)

Functions

This section is empty.

Types

type VideoInfo

type VideoInfo struct {
	ID       string        // The video's ID.
	Title    string        // Title of the video.
	Duration time.Duration // Duration of the video.
}

VideoInfo defines some detailed properties for a specific youtube video.

func GetVideoInfo

func GetVideoInfo(apiKey, id string) (*VideoInfo, error)

GetVideoInfo returns details about a specific video, identified by its ID. This is part of the youtube URL. E.g.:

URL: https://www.youtube.com/watch?v=dQw4w9WgXcQ
ID: dQw4w9WgXcQ

This returns nil and an error if the query failed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL