downloader

package
v0.0.0-...-4f4ff30 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: Unlicense Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadProgressWriter

type DownloadProgressWriter struct {
	ContentLength  int64
	ProgressOutput *feed.ProgressUpdateFeed
	// contains filtered or unexported fields
}

DownloadProgressWriter writes download percentage to provided ProgressOutput

func (*DownloadProgressWriter) Write

func (wc *DownloadProgressWriter) Write(p []byte) (int, error)

Write implements the io.Writer interface.

Always completes and never returns an error.

type Downloader

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

Downloader offers high level functions to download videos into files

func New

func New(c client.Client, videoID string, progressOutput *feed.ProgressUpdateFeed) *Downloader

New creates a new downloader with provided client

func (*Downloader) DownloadVideo

func (dl *Downloader) DownloadVideo(ctx context.Context) error

DownloadVideo returns a download handle

func (*Downloader) RetrieveVideoInfo

func (dl *Downloader) RetrieveVideoInfo(ctx context.Context) error

RetrieveVideoInfo fetches video info from youtube API

type ProgressBarWriter

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

ProgressBarWriter is used to write download progress to mpb progress bar

func (*ProgressBarWriter) Write

func (pbc *ProgressBarWriter) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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