Documentation ¶
Index ¶
- Constants
- Variables
- func BuildCustomUserAgent(...) string
- func GetAction(method string, url string) string
- type Addition
- type CaptchaTokenRequest
- type CaptchaTokenResponse
- type Common
- func (c *Common) GetCaptchaSign() (timestamp, sign string)
- func (c *Common) GetCaptchaToken() string
- func (c *Common) RefreshCaptchaTokenAtLogin(action, userID string) error
- func (c *Common) RefreshCaptchaTokenInLogin(action, username string) error
- func (c *Common) Request(url, method string, callback base.ReqCallback, resp interface{}) ([]byte, error)
- func (c *Common) SetCaptchaToken(captchaToken string)
- func (c *Common) SetDeviceID(deviceID string)
- func (c *Common) SetUserAgent(userAgent string)
- func (c *Common) SetUserID(userID string)
- type ErrResp
- type ExpertAddition
- type FileList
- type Files
- func (c *Files) CreateTime() time.Time
- func (c *Files) GetHash() utils.HashInfo
- func (c *Files) GetID() string
- func (c *Files) GetName() string
- func (c *Files) GetPath() string
- func (c *Files) GetSize() int64
- func (c *Files) IsDir() bool
- func (c *Files) ModTime() time.Time
- func (c *Files) Thumb() string
- type Link
- type SignInRequest
- type ThunderX
- type ThunderXExpert
- type TokenResp
- type UploadTaskResponse
- type XunLeiXCommon
- func (xc *XunLeiXCommon) Copy(ctx context.Context, srcObj, dstDir model.Obj) error
- func (xc *XunLeiXCommon) IsLogin() bool
- func (xc *XunLeiXCommon) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)
- func (xc *XunLeiXCommon) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error)
- func (xc *XunLeiXCommon) Login(username, password string) (*TokenResp, error)
- func (xc *XunLeiXCommon) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) error
- func (xc *XunLeiXCommon) Move(ctx context.Context, srcObj, dstDir model.Obj) error
- func (xc *XunLeiXCommon) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, ...) error
- func (xc *XunLeiXCommon) RefreshToken(refreshToken string) (*TokenResp, error)
- func (xc *XunLeiXCommon) Remove(ctx context.Context, obj model.Obj) error
- func (xc *XunLeiXCommon) Rename(ctx context.Context, srcObj model.Obj, newName string) error
- func (xc *XunLeiXCommon) Request(url string, method string, callback base.ReqCallback, resp interface{}) ([]byte, error)
- func (xc *XunLeiXCommon) SetRefreshTokenFunc(fn func() error)
- func (xc *XunLeiXCommon) SetTokenResp(tr *TokenResp)
Constants ¶
View Source
const ( API_URL = "https://api-pan.xunleix.com/drive/v1" FILE_API_URL = API_URL + "/files" XLUSER_API_URL = "https://xluser-ssl.xunleix.com/v1" )
View Source
const ( ClientID = "ZQL_zwA4qhHcoe_2" ClientSecret = "Og9Vr1L8Ee6bh0olFxFDRg" ClientVersion = "1.06.0.2132" PackageName = "com.thunder.downloader" DownloadUserAgent = "Dalvik/2.1.0 (Linux; U; Android 13; M2004J7AC Build/SP1A.210812.016)" SdkVersion = "2.0.3.203100 " )
View Source
const ( FOLDER = "drive#folder" FILE = "drive#file" RESUMABLE = "drive#resumable" )
View Source
const ( UPLOAD_TYPE_UNKNOWN = "UPLOAD_TYPE_UNKNOWN" //UPLOAD_TYPE_FORM = "UPLOAD_TYPE_FORM" UPLOAD_TYPE_RESUMABLE = "UPLOAD_TYPE_RESUMABLE" UPLOAD_TYPE_URL = "UPLOAD_TYPE_URL" )
Variables ¶
View Source
var Algorithms = []string{
"kVy0WbPhiE4v6oxXZ88DvoA3Q",
"lON/AUoZKj8/nBtcE85mVbkOaVdVa",
"rLGffQrfBKH0BgwQ33yZofvO3Or",
"FO6HWqw",
"GbgvyA2",
"L1NU9QvIQIH7DTRt",
"y7llk4Y8WfYflt6",
"iuDp1WPbV3HRZudZtoXChxH4HNVBX5ZALe",
"8C28RTXmVcco0",
"X5Xh",
"7xe25YUgfGgD0xW3ezFS",
"",
"CKCR",
"8EmDjBo6h3eLaK7U6vU2Qys0NsMx",
"t2TeZBXKqbdP09Arh9C3",
}
Functions ¶
func BuildCustomUserAgent ¶
Types ¶
type Addition ¶
type CaptchaTokenRequest ¶
type CaptchaTokenRequest struct { Action string `json:"action"` CaptchaToken string `json:"captcha_token"` ClientID string `json:"client_id"` DeviceID string `json:"device_id"` Meta map[string]string `json:"meta"` RedirectUri string `json:"redirect_uri"` }
* 验证码Token *
type CaptchaTokenResponse ¶
type Common ¶
type Common struct { // 签名相关,二选一 Algorithms []string Timestamp, CaptchaSign string // 必要值,签名相关 DeviceID string ClientID string ClientSecret string ClientVersion string PackageName string UserAgent string DownloadUserAgent string UseVideoUrl bool // contains filtered or unexported fields }
func (*Common) GetCaptchaToken ¶
func (*Common) RefreshCaptchaTokenAtLogin ¶
刷新验证码token(登录后)
func (*Common) RefreshCaptchaTokenInLogin ¶
刷新验证码token(登录时)
func (*Common) Request ¶
func (c *Common) Request(url, method string, callback base.ReqCallback, resp interface{}) ([]byte, error)
Request 只有基础信息的请求
func (*Common) SetCaptchaToken ¶
func (*Common) SetDeviceID ¶
func (*Common) SetUserAgent ¶
type ErrResp ¶
type ExpertAddition ¶
type ExpertAddition struct { driver.RootID LoginType string `json:"login_type" type:"select" options:"user,refresh_token" default:"user"` SignType string `json:"sign_type" type:"select" options:"algorithms,captcha_sign" default:"algorithms"` // 登录方式1 Username string `json:"username" required:"true" help:"login type is user,this is required"` Password string `json:"password" required:"true" help:"login type is user,this is required"` // 登录方式2 RefreshToken string `json:"refresh_token" required:"true" help:"login type is refresh_token,this is required"` // 签名方法1 Algorithms string `` /* 355-byte string literal not displayed */ // 签名方法2 CaptchaSign string `json:"captcha_sign" required:"true" help:"sign type is captcha_sign,this is required"` Timestamp string `json:"timestamp" required:"true" help:"sign type is captcha_sign,this is required"` // 验证码 CaptchaToken string `json:"captcha_token"` // 必要且影响登录,由签名决定 DeviceID string `json:"device_id" required:"false" default:""` ClientID string `json:"client_id" required:"true" default:"ZQL_zwA4qhHcoe_2"` ClientSecret string `json:"client_secret" required:"true" default:"Og9Vr1L8Ee6bh0olFxFDRg"` ClientVersion string `json:"client_version" required:"true" default:"1.06.0.2132"` PackageName string `json:"package_name" required:"true" default:"com.thunder.downloader"` ////不影响登录,影响下载速度 UserAgent string `json:"user_agent" required:"false" default:""` DownloadUserAgent string `json:"download_user_agent" required:"false" default:""` //优先使用视频链接代替下载链接 UseVideoUrl bool `json:"use_video_url"` }
高级设置
type FileList ¶
type FileList struct { Kind string `json:"kind"` NextPageToken string `json:"next_page_token"` Files []Files `json:"files"` Version string `json:"version"` VersionOutdated bool `json:"version_outdated"` }
* 文件 *
type Files ¶
type Files struct { Kind string `json:"kind"` ID string `json:"id"` ParentID string `json:"parent_id"` Name string `json:"name"` //UserID string `json:"user_id"` Size string `json:"size"` //Revision string `json:"revision"` //FileExtension string `json:"file_extension"` //MimeType string `json:"mime_type"` //Starred bool `json:"starred"` WebContentLink string `json:"web_content_link"` CreatedTime time.Time `json:"created_time"` ModifiedTime time.Time `json:"modified_time"` IconLink string `json:"icon_link"` ThumbnailLink string `json:"thumbnail_link"` // Md5Checksum string `json:"md5_checksum"` Hash string `json:"hash"` // Links map[string]Link `json:"links"` // Phase string `json:"phase"` // Audit struct { // Status string `json:"status"` // Message string `json:"message"` // Title string `json:"title"` // } `json:"audit"` Medias []struct { //Category string `json:"category"` //IconLink string `json:"icon_link"` //IsDefault bool `json:"is_default"` //IsOrigin bool `json:"is_origin"` //IsVisible bool `json:"is_visible"` Link Link `json:"link"` } `json:"medias"` Trashed bool `json:"trashed"` DeleteTime string `json:"delete_time"` OriginalURL string `json:"original_url"` }
func (*Files) CreateTime ¶
type SignInRequest ¶
type ThunderX ¶
type ThunderX struct { *XunLeiXCommon model.Storage Addition // contains filtered or unexported fields }
func (*ThunderX) GetAddition ¶
func (x *ThunderX) GetAddition() driver.Additional
type ThunderXExpert ¶
type ThunderXExpert struct { *XunLeiXCommon model.Storage ExpertAddition // contains filtered or unexported fields }
func (*ThunderXExpert) Config ¶
func (x *ThunderXExpert) Config() driver.Config
func (*ThunderXExpert) GetAddition ¶
func (x *ThunderXExpert) GetAddition() driver.Additional
func (*ThunderXExpert) SetTokenResp ¶
func (x *ThunderXExpert) SetTokenResp(token *TokenResp)
type TokenResp ¶
type TokenResp struct { TokenType string `json:"token_type"` AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` ExpiresIn int64 `json:"expires_in"` Sub string `json:"sub"` UserID string `json:"user_id"` }
* 登录 *
type UploadTaskResponse ¶
type UploadTaskResponse struct { UploadType string `json:"upload_type"` //UPLOAD_TYPE_RESUMABLE Resumable struct { Kind string `json:"kind"` Params struct { AccessKeyID string `json:"access_key_id"` AccessKeySecret string `json:"access_key_secret"` Bucket string `json:"bucket"` Endpoint string `json:"endpoint"` Expiration time.Time `json:"expiration"` Key string `json:"key"` SecurityToken string `json:"security_token"` } `json:"params"` Provider string `json:"provider"` } `json:"resumable"` File Files `json:"file"` }
* 上传 *
type XunLeiXCommon ¶
func (*XunLeiXCommon) IsLogin ¶
func (xc *XunLeiXCommon) IsLogin() bool
func (*XunLeiXCommon) Login ¶
func (xc *XunLeiXCommon) Login(username, password string) (*TokenResp, error)
Login 登录
func (*XunLeiXCommon) Put ¶
func (xc *XunLeiXCommon) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up driver.UpdateProgress) error
func (*XunLeiXCommon) RefreshToken ¶
func (xc *XunLeiXCommon) RefreshToken(refreshToken string) (*TokenResp, error)
RefreshToken 刷新Token
func (*XunLeiXCommon) Request ¶
func (xc *XunLeiXCommon) Request(url string, method string, callback base.ReqCallback, resp interface{}) ([]byte, error)
Request 携带Authorization和CaptchaToken的请求
func (*XunLeiXCommon) SetRefreshTokenFunc ¶
func (xc *XunLeiXCommon) SetRefreshTokenFunc(fn func() error)
SetRefreshTokenFunc 设置刷新Token的方法
func (*XunLeiXCommon) SetTokenResp ¶
func (xc *XunLeiXCommon) SetTokenResp(tr *TokenResp)
SetTokenResp 设置Token
Click to show internal directories.
Click to hide internal directories.