downloader

package
v0.0.0-...-7142fe3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyList = make([]Data, 0)

EmptyList empty Data list

Functions

func Caption

func Caption(url, refer, fileName, ext string) error

Caption download danmaku, subtitles, etc

func Download

func Download(v Data, refer string, chunkSizeMB int) error

Download download urls

func Save

func Save(
	urlData URL, refer, fileName string, bar *pb.ProgressBar, chunkSizeMB int,
) error

Save save url file

Types

type Aria2Input

type Aria2Input struct {
	// The file name of the downloaded file
	Out string `json:"out"`
	// For a simple download, only add headers
	Header []string `json:"header"`
}

Aria2Input options for `aria2.addUri` https://aria2.github.io/manual/en/html/aria2c.html#id3

type Aria2RPCData

type Aria2RPCData struct {
	// More info about RPC interface please refer to
	// https://aria2.github.io/manual/en/html/aria2c.html#rpc-interface
	JSONRPC string `json:"jsonrpc"`
	ID      string `json:"id"`
	// For a simple download, only inplemented `addUri`
	Method string `json:"method"`
	// secret, uris, options
	Params [3]interface{} `json:"params"`
}

Aria2RPCData json RPC 2.0 for Aria2

type Data

type Data struct {
	Site  string `json:"site"`
	Title string `json:"title"`
	Type  string `json:"type"`
	// each stream has it's own URLs and Quality
	Streams map[string]Stream `json:"streams"`

	// Err is used to record whether an error occurred when extracting data.
	// It is used to record the error information corresponding to each url when extracting the list data.
	// NOTE(iawia002): err is only used in Data list
	Err error `json:"-"`
	// URL is used to record the address of this download
	URL string `json:"url"`
	// contains filtered or unexported fields
}

Data data struct for video information

func EmptyData

func EmptyData(url string, err error) Data

EmptyData returns an "empty" Data object with the given URL and error

type Stream

type Stream struct {
	// [URL: {URL, Size, Ext}, ...]
	// Some video files have multiple fragments
	// and support for downloading multiple image files at once
	URLs    []URL  `json:"urls"`
	Quality string `json:"quality"`
	// total size of all urls
	Size int64 `json:"size"`
	// contains filtered or unexported fields
}

Stream data struct for each stream

type URL

type URL struct {
	URL  string `json:"url"`
	Size int64  `json:"size"`
	Ext  string `json:"ext"`
}

URL data struct for single URL information

Jump to

Keyboard shortcuts

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