downloader

package
v0.0.0-...-6a448fc Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadOption

type DownloadOption struct {
	ContentCredit string // content credit
	Format        string // download format
	Force         bool   // force download, delete the existing file
}

func (*DownloadOption) Validate

func (opt *DownloadOption) Validate() error

type Downloader

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

Downloader is responsible for downloading contents using youtube-dl. @see https://github.com/yt-dlp/yt-dlp

func NewDownloader

func NewDownloader(conf *conf.DownloaderConfig) (*Downloader, error)

NewDownloader creates a new Downloader instance and ensures the necessary binaries and directories are set up.

func (*Downloader) Download

func (d *Downloader) Download(ctx context.Context, opt *DownloadOption) (*Result, error)

Download downloads a content based on the provided DownloadOption and returns the Result.

func (*Downloader) TryStart

func (d *Downloader) TryStart(ctx context.Context, next func() *dao.Content, update func(dao.Content, *Result))

type Result

type Result struct {
	Finished   bool    // download finished
	Progress   float64 // download progress
	ContentURL string  // content url
	Output     string  // absolute output file path
}

Jump to

Keyboard shortcuts

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