video

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertVideoToAudio

func ConvertVideoToAudio(video *Video, dstDir string, results chan<- ChannelMessage)

ConvertVideoToAudio converts video to mp3 and saves in dstDir.

func FetchMetadata

func FetchMetadata(video *Video, results chan<- ChannelMessage)

FetchMetadata fetches metadata for video using python port of youtube-dl.

func FetchPlaybackURL

func FetchPlaybackURL(link string, results chan<- ChannelMessage)

FetchPlaybackURL gets playback stream: - If video is not well-protected get stream url using regex. - If video is well-protected get stream url using python port of youtube-dl.

func FetchVideo

func FetchVideo(video *Video, results chan<- ChannelMessage)

FetchVideo downloads video and saves it in a temp file.

func ValidateLinks(links []string) []error

ValidateLinks ensures:

  • links are valid parseable URLs
  • links are YouTube links

Types

type ChannelMessage

type ChannelMessage struct {
	Result *Video
	Err    error
	Link   string
}

ChannelMessage used to exchange between a main thread and goroutines.

func (ChannelMessage) String

func (msg ChannelMessage) String() string
type ErrorBadLink struct {
	// contains filtered or unexported fields
}

ErrorBadLink link is not valid.

func (*ErrorBadLink) Error

func (e *ErrorBadLink) Error() string

type ErrorFetchPlaybackURL

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

ErrorFetchPlaybackURL video stream URL can't be fetched/found.

func (*ErrorFetchPlaybackURL) Error

func (e *ErrorFetchPlaybackURL) Error() string

type PBReader

type PBReader struct {
	io.Reader
	// contains filtered or unexported fields
}

PBReader wraps an existing io.Reader. It simply forwards the Read() call, while tracking progress to progress bar.

func (*PBReader) Read

func (pbr *PBReader) Read(p []byte) (int, error)

Read 'overrides' the underlying io.Reader's Read method. This is the one that will be called by io.Copy(). We use it to keep track progress using bar and then forward the call.

type Video

type Video struct {
	File          *os.File
	AudioFilePath string
	// contains filtered or unexported fields
}

Video internal video object.

func (Video) HasStreamURL

func (v Video) HasStreamURL() bool

func (Video) String

func (v Video) String() string

Jump to

Keyboard shortcuts

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