Documentation ¶
Index ¶
- Constants
- func AddProxy(proxyUrlStr string, transport *http.Transport)
- func DirectoryName(p kemono.Post) string
- func NewDownloader(options ...DownloadOption) kemono.Downloader
- func NewProgressBar(content string, max int64, length int) *progressBar
- type DownloadOption
- func Async(async bool) DownloadOption
- func BaseURL(baseURL string) DownloadOption
- func MaxConcurrent(maxConcurrent int) DownloadOption
- func MaxSize(maxSize int64) DownloadOption
- func MinSize(minSize int64) DownloadOption
- func OverWrite(overwrite bool) DownloadOption
- func RateLimit(n int) DownloadOption
- func Retry(retry int) DownloadOption
- func RetryInterval(interval time.Duration) DownloadOption
- func SavePath(...) DownloadOption
- func SetLog(log Log) DownloadOption
- func Timeout(timeout time.Duration) DownloadOption
- func WithContent(content bool) DownloadOption
- func WithCookie(cookies []*http.Cookie) DownloadOption
- func WithHeader(header Header) DownloadOption
- func WithProxy(proxy string) DownloadOption
- type Header
- type Log
- type Progress
- func (p *Progress) AddBar(bar *progressBar)
- func (p *Progress) Cancel(bar *progressBar, err string)
- func (p *Progress) Failed(bar *progressBar, err error)
- func (p *Progress) Print(s string)
- func (p *Progress) Remove(bar *progressBar)
- func (p *Progress) Run(interval time.Duration)
- func (p *Progress) SetStatus()
- func (p *Progress) Success(bar *progressBar)
Constants ¶
View Source
const ( UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" Accept = "" /* 135-byte string literal not displayed */ AcceptEncoding = "gzip, deflate, br" AcceptLanguage = "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7" SecChUA = "\"Google Chrome\";v=\"111\", \"Not(A:Brand\";v=\"8\", \"Chromium\";v=\"111\"" SecChUAMobile = "?0" SecFetchDest = "document" SecFetchMode = "navigate" SecFetchSite = "none" SecFetchUser = "?1" UpgradeInsecureRequests = "1" )
View Source
const ( DeepRed = "\x1b[38;5;196m" Red = "\x1b[38;5;197m" Green = "\x1b[38;5;106m" DeepYellow = "\x1b[38;5;178m" Blue = "\x1b[38;5;67m" Purple = "\x1b[38;5;133m" Grey = "\x1b[38;5;243m" White = "\x1b[38;5;251m" )
View Source
const ( BarModeDownload = "Download" BarModeCancel = "Cancel" BarModeFailed = "Failed" BarModeSuccess = "Success" )
Variables ¶
This section is empty.
Functions ¶
func DirectoryName ¶
func NewDownloader ¶
func NewDownloader(options ...DownloadOption) kemono.Downloader
func NewProgressBar ¶ added in v0.0.6
Types ¶
type DownloadOption ¶
type DownloadOption func(*downloader)
func MaxConcurrent ¶
func MaxConcurrent(maxConcurrent int) DownloadOption
MaxConcurrent set the max concurrent download
func MaxSize ¶ added in v0.0.2
func MaxSize(maxSize int64) DownloadOption
MaxSize set the max size of the file to download
func MinSize ¶ added in v0.0.2
func MinSize(minSize int64) DownloadOption
MinSize set the min size of the file to download
func RateLimit ¶
func RateLimit(n int) DownloadOption
RateLimit limit the rate of download per second
func Retry ¶
func Retry(retry int) DownloadOption
func RetryInterval ¶
func RetryInterval(interval time.Duration) DownloadOption
func WithContent ¶ added in v0.0.10
func WithContent(content bool) DownloadOption
func WithCookie ¶ added in v0.0.8
func WithCookie(cookies []*http.Cookie) DownloadOption
func WithHeader ¶
func WithHeader(header Header) DownloadOption
func WithProxy ¶ added in v0.0.7
func WithProxy(proxy string) DownloadOption
type Progress ¶ added in v0.0.6
type Progress struct {
// contains filtered or unexported fields
}
func NewProgress ¶ added in v0.0.6
Click to show internal directories.
Click to hide internal directories.