youtube

package
v0.0.0-...-24a922d Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB float64 = 1 << (10 * (iota + 1))
	MB
	GB
)
View Source
const (
	// Youtube video meta source url
	URL_META = "https://www.youtube.com/get_video_info?&video_id="
)

Variables

View Source
var (
	// Video formats
	Formats = []string{"3gp", "mp4", "flv", "webm", "avi"}
)

Functions

This section is empty.

Types

type Format

type Format struct {
	Itag                     int
	Video_type, Quality, Url string
}

type Option

type Option struct {
	Resume bool // resume failed or cancelled download
	Rename bool // rename output file using video title
	Mp3    bool // extract audio using ffmpeg
}

Download options

type Video

type Video struct {
	Id, Title, Author, Keywords, Thumbnail_url string
	Avg_rating                                 float32
	View_count, Length_seconds                 int
	Formats                                    []Format
	Filename                                   string
}

holds a video's information

func Get

func Get(video_id string) (Video, error)

given a video id, get it's information from youtube

func (*Video) Download

func (video *Video) Download(index int, filename string, option *Option) error

func (*Video) GetExtension

func (v *Video) GetExtension(index int) string

figure out the file extension from a codec string

func (*Video) IndexByItag

func (v *Video) IndexByItag(itag int) (int, *Format)

Returns video format index by Itag number, or nil if unknown

Jump to

Keyboard shortcuts

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