downloader

package
v0.0.0-...-e774c9b Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KB = 1024
	MB = 1024 * 1024
	GB = 1024 * 1024 * 1024
)

Variables

View Source
var Logger *logrus.Logger

Functions

This section is empty.

Types

type M3u8Downloader

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

func Default

func Default(url, saveName string) *M3u8Downloader

func New

func New(url, saveName, downPath, savePath string, clearDebris bool, threads, maxRetry uint,
	isShardFunc func(line string) (need bool),
	fixShardFunc func(shard string, m3u8Url string) string,
	requestFunc func(url string) (*http.Client, *http.Request, error),
) *M3u8Downloader

func (*M3u8Downloader) Crawl

func (d *M3u8Downloader) Crawl()

func (*M3u8Downloader) Run

func (d *M3u8Downloader) Run() (err error)

prepare -> parse -> fix -> download -> merge -> clear

func (*M3u8Downloader) SetFixShardFunc

func (d *M3u8Downloader) SetFixShardFunc(fixShardFunc func(shard string, m3u8Url string) string)

func (*M3u8Downloader) SetIsShardFunc

func (d *M3u8Downloader) SetIsShardFunc(isShardFunc func(line string) (need bool))

func (*M3u8Downloader) SetRequestFunc

func (d *M3u8Downloader) SetRequestFunc(requestFunc func(url string) (*http.Client, *http.Request, error))

type ProcessBar

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

func NewBar

func NewBar(current, total int) *ProcessBar

func NewBarWithGraph

func NewBarWithGraph(start, total int, graph string) *ProcessBar

func (*ProcessBar) Add

func (b *ProcessBar) Add(bytes uint64)

func (*ProcessBar) Reset

func (b *ProcessBar) Reset(current int)

func (*ProcessBar) Start

func (b *ProcessBar) Start()

type WaitGroup

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

func NewWaitGroup

func NewWaitGroup(parallel int) (w *WaitGroup)

func (*WaitGroup) AddDelta

func (w *WaitGroup) AddDelta()

func (*WaitGroup) Done

func (w *WaitGroup) Done()

func (*WaitGroup) Parallel

func (w *WaitGroup) Parallel() int

func (*WaitGroup) Wait

func (w *WaitGroup) Wait()

Jump to

Keyboard shortcuts

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