ytp

package
v0.0.0-...-916f762 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHandlers

func AddHandlers(s *discordgo.Session)

This adds a handler to the given discord session, which will look for messages sent that start with ~play

func Search(term string) string

This searches youtube for the given search terms, and returns a video id.

Types

type Video

type Video struct {
	// contains filtered or unexported fields
}

func GetVideo

func GetVideo(url string) (*Video, error)

This gets a video from a url. This does not fetch any data, you must call Video.Download* functions in order to download anything. This will search for the video if the url does not start with https://.

func (*Video) AudioURL

func (v *Video) AudioURL(sample_rate int) string

This returns the url to an audio file.

func (*Video) ID

func (v *Video) ID() string

This returns the video id

func (*Video) Info

func (v *Video) Info() map[string]interface{}

This gets metadata like the date uploaded, and the title of the video. This function will cache the info, so calling it multiple times will only ever access the network once. Call RefreshInfo to refresh this cache.

func (*Video) RefreshInfo

func (v *Video) RefreshInfo() map[string]interface{}

This gets the video info, and always accesses the network. There is little reason to call this function (Info() will cache the result, and only access the network on the first call)

func (*Video) URL

func (v *Video) URL() string

This returns a url to the video, in the format https://youtu.be/<id>

Jump to

Keyboard shortcuts

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