Documentation ¶
Index ¶
- Constants
- Variables
- func BindDownloadArgs(command *cobra.Command, config *Config)
- func LoadConfig(c *Config, aliC *AliYunConfig)
- func NewAliyunDrive(c *Client, aliConfig *AliYunConfig) *aliyundrive.AliYunDrive
- func NewCookieJar(path string) (http.CookieJar, error)
- func ResolveAliyunDrive(client *Client, shareUrl string, sharePwd string, formats ...string) ([]string, error)
- func ValidateDownloadConfig(config *Config)
- type AliYunConfig
- type Client
- func (c *Client) CheckRedirect(checkFunc func(req *http.Request, via []*http.Request) error)
- func (c *Client) FormPost(link, referer string, form Form) (*http.Response, error)
- func (c *Client) Get(link, referer string, params ...*Query) (*http.Response, error)
- func (c *Client) Retry(f func() error) (err error)
- type Config
- type Field
- type Form
- type Query
Constants ¶
View Source
const DefaultUserAgent = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.51 Safari/537.36"
Variables ¶
View Source
var ( ErrInitialBookID = errors.New("illegal book id, it should exceed 0") ErrRetryTimes = errors.New("illegal retry times, it should exceed 0") ErrThreadCounts = errors.New("illegal download thread counts, it should exceed 0") )
View Source
var AliyunConfig = &AliYunConfig{}
Functions ¶
func BindDownloadArgs ¶
BindDownloadArgs will bind the download arguments to cobra command.
func LoadConfig ¶
func LoadConfig(c *Config, aliC *AliYunConfig)
func NewAliyunDrive ¶
func NewAliyunDrive(c *Client, aliConfig *AliYunConfig) *aliyundrive.AliYunDrive
func NewCookieJar ¶
NewCookieJar would create a cookie jar instance. It supports auto saving policy.
func ResolveAliyunDrive ¶
func ValidateDownloadConfig ¶
func ValidateDownloadConfig(config *Config)
ValidateDownloadConfig would print the final download config table.
Types ¶
type AliYunConfig ¶
type AliYunConfig struct {
RefreshToken string
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CheckRedirect ¶
CheckRedirect add extra check func for 302 or 301 redirect.
type Config ¶
type Config struct { Website string // The website for talebook. Username string // The login user. Password string // The password for login user. DownloadPath string // Use the executed directory as the default download path. CookieFile string // The cookie file to use in this download progress. ProgressFile string // The progress file serving the remaining book id. InitialBookID int // The book id start to download. Formats []string // The file formats you want to download Timeout time.Duration // The request timeout for a single request. Retry int // The maximum retry times for a timeout request. UserAgent string // The user agent for the download request. Rename bool // Rename the file by using book ID. Thread int // The number of download thread. Debug bool // Enable debug log. }
Click to show internal directories.
Click to hide internal directories.