Documentation
¶
Index ¶
Constants ¶
View Source
const (
// URI is an API endpoint
URI = "https://www.googleapis.com/youtube/v3/videos?id=%s&part=contentDetails&key=%s"
)
Variables ¶
View Source
var ErrKey = errors.New("get a key here: https://console.developers.google.com/apis/api/youtube.googleapis.com")
ErrKey YouTube API key error
Functions ¶
func GetDuration ¶
GetDuration returns duration from YouTube video id you should pass a valid YouTube Data API Key. Can get one here: https://console.developers.google.com/apis/api/youtube.googleapis.com"
func ParseDuration ¶
ParseDuration converts duration in YouTube format to 15:04:05
Types ¶
type ContentDetails ¶
type ContentDetails struct {
Etag string `json:"etag"`
Items []struct {
ContentDetails struct {
Caption string `json:"caption"`
Definition string `json:"definition"`
Dimension string `json:"dimension"`
Duration string `json:"duration"`
LicensedContent bool `json:"licensedContent"`
Projection string `json:"projection"`
} `json:"contentDetails"`
Etag string `json:"etag"`
ID string `json:"id"`
Kind string `json:"kind"`
} `json:"items"`
Kind string `json:"kind"`
PageInfo struct {
ResultsPerPage int64 `json:"resultsPerPage"`
TotalResults int64 `json:"totalResults"`
} `json:"pageInfo"`
}
ContentDetails is a response struct for YouTube API call
Click to show internal directories.
Click to hide internal directories.