Documentation
¶
Overview ¶
Package youtubelength get the length of Youtube videos.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultClient = Client{}
DefaultClient is a default youtubelength.Client.
Functions ¶
func Get ¶
Get gets the length of the video using the DefaultClient.
Example ¶
package main
import (
"context"
"fmt"
"4d63.com/youtubelength"
)
func main() {
// https://www.youtube.com/watch?v=G_OlRWGLdnw
length, err := youtubelength.Get(context.Background(), "G_OlRWGLdnw")
if err != nil {
fmt.Println(err)
}
fmt.Println(length)
}
Output: 6m51s
Types ¶
type Client ¶
type Client struct {
// HTTPClient is an optional http.Client that will be used to get the
// length of the Youtube video. If it is not set a zero http.Client with a
// timeout of 10s will be used.
HTTPClient *http.Client
}
Client is the client that can get the length of a Youtube video.
Click to show internal directories.
Click to hide internal directories.