gotube

package module
v0.0.0-...-f6499e9 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 7 Imported by: 0

README

gotube

A simple library for search and download video/audio from youtube

Documentation

Index

Constants

View Source
const VideoBaseUrl string = "https://www.youtube.com/watch?v="

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Id          string
	Title       string
	Description string
	Thumbnails  Thumbnails
}

Channel is a type with channel information.

type Format

type Format string

Format of video

var (
	FormatMp4 Format = "mp4"
	FormatM4a Format = "m4a"
	FormatMp3 Format = "mp3"
	Format3gp Format = "3gp"
)

type Playlist

type Playlist struct {
	Id          string
	Title       string
	Description string
	Channel     *Channel
	Thumbnails  Thumbnails
}

Playlist is a struct with playlist information

type Quality

type Quality string

Quality of video

const (
	QualityVideo144   Quality = "144p"
	QualityVideo240   Quality = "240p"
	QualityVideo480   Quality = "480p"
	QualityVideo630   Quality = "630p"
	QualityVideo720   Quality = "720p"
	QualityVideo1080p Quality = "1080p"
	QualityAudio128   Quality = "128kbps"
)

type SearchOptions

type SearchOptions struct {
	Query  string
	Limit  int64
	ApiKey string
}

SearchOptions is a struct with the search option information

type SearchResult

type SearchResult struct {
	Channels  []*Channel
	Videos    []*Video
	Playlists []*Playlist
}
func Search(opts SearchOptions) (results *SearchResult, err error)

Search è una funzione che data una query e un limit effettua una ricerca e torna una slice di video info

type Thumbnails

type Thumbnails struct {
	youtube.ThumbnailDetails
}

type Video

type Video struct {
	Id          string
	Url         string
	Title       string
	Description string
	Thumbnails  Thumbnails
	PublishedAt string
	Channel     *Channel
	Options     []*VideoOptions
	// contains filtered or unexported fields
}

Video is a type that contains video information

func NewVideoById

func NewVideoById(id string) (*Video, error)

NewVideoById is a function that creates a new Video instance by id

func NewVideoByUrl

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

NewVideoByUrl is a function that creates a new Video instance by url

func (v *Video) GetDirectLink(opts *VideoOptions) (string, error)

GetDirectLink is a Video method that returns the direct link of the video

type VideoOptions

type VideoOptions struct {
	Format  Format
	Quality Quality
}

VideoOptions are option of video

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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