Documentation
¶
Index ¶
- Constants
- Variables
- func BoolToInt(b bool) int
- func MakeUserAgent(name string) string
- func ParseFileTime(str string) time.Time
- func UploadCalculateSignature(userId, userKey, fileId, targetId string) string
- func UploadCalculateToken(userId, fileId, preId string, fileSize, timestamp int64) string
- type BasicResponse
- type BoolInt
- type CaptchaSignResponse
- type DirLocateResponse
- type DirMakeResponse
- type DownloadData
- type DownloadInfo
- type DownloadRequest
- type DownloadUrl
- type FileDownloadUrl
- type FileDuplication
- type FileInfo
- type FileListResponse
- type FileParentInfo
- type FileStatResponse
- type ImageData
- type IndexData
- type IntString
- type LabelInfo
- type LabelListData
- type LoginBasicResponse
- type LoginCheckData
- type LoginCheckResponse
- type LoginDeviceInfo
- type LoginUserData
- type OfflineAddUrlResponse
- type OfflineBasicResponse
- type OfflineListResponse
- type OfflineSpaceResponse
- type OfflineTask
- type OfflineToken
- type QrcodeStatusData
- type QrcodeTokenData
- type SizeInfo
- type StringFloat64
- type StringInt
- type StringInt64
- type UploadInfoResponse
- type UploadInitResponse
- type UploadOssParams
- type UploadOssTokenResponse
- type UploadResultData
- type UploadSimpleInitResponse
- type UploadToken
- type UserInfoData
- type VersionData
- type VersionInfo
- type VideoResponse
Constants ¶
View Source
const ( ApiUserInfo = "https://my.115.com/?ct=ajax&ac=nav" ApiIndexInfo = "https://webapi.115.com/files/index_info" ApiLoginCheck = "https://passportapi.115.com/app/1.0/web/1.0/check/sso" ApiLoginGetKey = "https://passportapi.115.com/app/1.0/web/5.0.1/login/getKey" ApiPasswordLogin = "https://passportapi.115.com/app/1.0/web/1.0/login/login" ApiSmsSendCode = "https://passportapi.115.com/app/1.0/web/1.0/code/sms/login" ApiSmsLogin = "https://passportapi.115.com/app/1.0/web/1.0/login/vip" ApiQrcodeToken = "https://qrcodeapi.115.com/api/1.0/web/1.0/token" ApiQrcodeStatus = "https://qrcodeapi.115.com/get/status/" ApiQrcodeLogin = "https://passportapi.115.com/app/1.0/web/1.0/login/qrcode" ApiFileList = "https://webapi.115.com/files" ApiFileListByName = "https://aps.115.com/natsort/files.php" ApiFileSearch = "https://webapi.115.com/files/search" ApiFileInfo = "https://webapi.115.com/files/get_info" ApiFileStat = "https://webapi.115.com/category/get" ApiFileStar = "https://webapi.115.com/files/star" ApiFileEdit = "https://webapi.115.com/files/edit" ApiFileMove = "https://webapi.115.com/files/move" ApiFileCopy = "https://webapi.115.com/files/copy" ApiFileRename = "https://webapi.115.com/files/batch_rename" ApiFileDelete = "https://webapi.115.com/rb/delete" ApiFileFindDuplicate = "https://webapi.115.com/files/get_repeat_sha" ApiLabelList = "https://webapi.115.com/label/list" ApiLabelAdd = "https://webapi.115.com/label/add_multi" ApiLabelEdit = "https://webapi.115.com/label/edit" ApiLabelDelete = "https://webapi.115.com/label/delete" ApiDirAdd = "https://webapi.115.com/files/add" ApiDirGetId = "https://webapi.115.com/files/getid" ApiDirSetOrder = "https://webapi.115.com/files/order" ApiFileImage = "https://webapi.115.com/files/image" ApiFileVideo = "https://v.anxia.com/webapi/files/video" ApiOfflineSpace = "https://115.com/?ct=offline&ac=space" ApiOfflineList = "https://115.com/web/lixian/?ct=lixian&ac=task_lists" ApiOfflineAddUrl = "https://115.com/web/lixian/?ct=lixian&ac=add_task_url" ApiOfflineDelete = "https://115.com/web/lixian/?ct=lixian&ac=task_del" ApiOfflineClear = "https://115.com/web/lixian/?ct=lixian&ac=task_clear" ApiDownloadGetUrl = "https://proapi.115.com/app/chrome/downurl" ApiUploadInfo = "https://proapi.115.com/app/uploadinfo" ApiUploadOssToken = "https://uplb.115.com/3.0/gettoken.php" ApiUploadInit = "https://uplb.115.com/3.0/initupload.php" ApiUploadSimpleInit = "https://uplb.115.com/3.0/sampleinitupload.php" ApiCaptchaPage = "https://captchaapi.115.com/?ac=security_code&type=web" ApiCaptchaCodeImage = "https://captchaapi.115.com/?ct=index&ac=code&ctype=0" ApiCaptchaAllKeyImage = "https://captchaapi.115.com/?ct=index&ac=code&t=all" ApiCaptchaOneKeyImage = "https://captchaapi.115.com/?ct=index&ac=code&t=single" ApiCaptchaSign = "https://captchaapi.115.com/?ac=code&t=sign" ApiCaptchaSubmit = "https://webapi.115.com/user/captcha" ApiGetVersion = "https://appversion.115.com/1/web/1.0/api/chrome" )
View Source
const ( FileOrderByTime = "user_ptime" FileOrderByType = "file_type" FileOrderBySize = "file_size" FileOrderByName = "file_name" FileListLimit = 32 )
View Source
const ( CookieDomain115 = ".115.com" CookieDomainAnxia = ".anxia.com" CookieUrl = "https://115.com" CookieNameUid = "UID" CookieNameCid = "CID" CookieNameSeid = "SEID" )
View Source
const ( UploadMaxSize = 5 * 1024 * 1024 * 1024 UploadSimplyMaxSize = 200 * 1024 * 1024 UploadPreSize = 128 * 1024 )
Variables ¶
View Source
var ( ErrNotLogin = errors.New("user not login") ErrOfflineInvalidLink = errors.New("invalid download link") ErrOfflineTaskExisted = errors.New("offline task existed") ErrOrderNotSupport = errors.New("file order not supported") ErrPasswordIncorrect = errors.New("password incorrect") ErrLoginTwoStepVerify = errors.New("requires two-step verification") ErrAccountNotBindMobile = errors.New("account not binds mobile") ErrCredentialInvalid = errors.New("credential invalid") ErrSessionExited = errors.New("session exited") ErrQrcodeExpired = errors.New("qrcode expired") // ErrUnexpected is the fall-back error whose code is not handled. ErrUnexpected = errors.New("unexpected error") // ErrExist means an item which you want to create is already existed. ErrExist = errors.New("target already exists") // ErrNotExist means an item which you find is not existed. ErrNotExist = errors.New("target does not exist") // ErrReachEnd means there are no more item. ErrReachEnd = errors.New("reach the end") ErrInvalidCursor = errors.New("invalid cursor") ErrUploadTooLarge = errors.New("upload reach the limit") ErrImportDirectory = errors.New("can not import directory") ErrDownloadEmpty = errors.New("can not get download URL") ErrDownloadDirectory = errors.New("can not download directory") ErrVideoNotReady = errors.New("video is not ready") ErrInvalidImportURI = errors.New("invalid import URI") )
View Source
var ( LabelColors = []string{ "#000000", "#FF4B30", "#F78C26", "#FFC032", "#43BA80", "#2670FC", "#8B69FE", "#CCCCCC", } LabelColorMap = map[string]int{ "#000000": 0, "#FF4B30": 1, "#F78C26": 2, "#FFC032": 3, "#43BA80": 4, "#2670FC": 5, "#8B69FE": 6, "#CCCCCC": 7, } )
View Source
var (
AppVersion = ""
)
View Source
var ( DirOrderModes = []string{ FileOrderByTime, FileOrderByType, FileOrderBySize, FileOrderByName, } )
Functions ¶
func MakeUserAgent ¶ added in v0.3.1
func ParseFileTime ¶ added in v0.3.2
func UploadCalculateSignature ¶ added in v0.3.2
func UploadCalculateToken ¶ added in v0.3.2
Types ¶
type BasicResponse ¶
type BasicResponse struct {
// Response state
State bool `json:"state"`
// Error code
ErrorCode StringInt `json:"errno,omitempty"`
ErrorCode2 int `json:"errNo,omitempty"`
ErrorCode3 int `json:"code,omitempty"`
// Error message
ErrorMessage string `json:"error,omitempty"`
ErrorMessage2 string `json:"message,omitempty"`
// Response data
Data json.RawMessage `json:"data,omitempty"`
}
func (*BasicResponse) Decode ¶
func (r *BasicResponse) Decode(result interface{}) error
func (*BasicResponse) Err ¶
func (r *BasicResponse) Err() error
type CaptchaSignResponse ¶
type CaptchaSignResponse struct {
BasicResponse
Sign string `json:"sign"`
}
type DirLocateResponse ¶
type DirLocateResponse struct {
BasicResponse
DirId IntString `json:"id"`
IsPrivate StringInt `json:"is_private"`
}
type DirMakeResponse ¶
type DownloadData ¶
type DownloadData map[string]*DownloadInfo
func (DownloadData) IsValid ¶ added in v0.3.1
func (d DownloadData) IsValid() bool
type DownloadInfo ¶
type DownloadInfo struct {
FileName string `json:"file_name"`
FileSize StringInt64 `json:"file_size"`
PickCode string `json:"pick_code"`
Url DownloadUrl `json:"url"`
}
type DownloadRequest ¶
type DownloadRequest struct {
Pickcode string `json:"pickcode,omitempty"`
}
type DownloadUrl ¶ added in v0.3.1
type DownloadUrl struct {
Url string
}
func (*DownloadUrl) UnmarshalJSON ¶ added in v0.3.1
func (u *DownloadUrl) UnmarshalJSON(b []byte) (err error)
type FileDownloadUrl ¶ added in v0.3.1
type FileDuplication ¶
type FileDuplication struct {
FileId string `json:"fid"`
Name string `json:"fn"`
Type string `json:"ico"`
Size StringInt64 `json:"fs"`
Sha1 string `json:"sha1"`
PickCode string `json:"pc"`
UpdateTime StringInt64 `json:"te"`
Parent FileParentInfo `json:"paths"`
}
type FileInfo ¶
type FileInfo struct {
AreaId IntString `json:"aid"`
CategoryId string `json:"cid"`
FileId string `json:"fid"`
ParentId string `json:"pid"`
Name string `json:"n"`
Type string `json:"ico"`
Size StringInt64 `json:"s"`
Sha1 string `json:"sha"`
PickCode string `json:"pc"`
IsStar StringInt `json:"m"`
Labels []*LabelInfo `json:"fl"`
CreatedTime string `json:"tp"`
UpdatedTime string `json:"te"`
ModifiedTime string `json:"t"`
// MediaDuration describes duration in seconds for audio / video.
MediaDuration float64 `json:"play_long"`
// Special fields for video
IsVideo int `json:"iv"`
VideoDefinition int `json:"vdi"`
}
type FileListResponse ¶
type FileParentInfo ¶
type FileStatResponse ¶
type FileStatResponse struct {
BasicResponse
FileName string `json:"file_name"`
PickCode string `json:"pick_code"`
Sha1 string `json:"sha1"`
IsFile StringInt `json:"file_category"`
CreateTime StringInt64 `json:"ptime"`
UpdateTime StringInt64 `json:"utime"`
AccessTime int64 `json:"open_time"`
Paths []*FileParentInfo `json:"paths"`
FileCount StringInt `json:"count"`
DirCount StringInt `json:"folder_count"`
}
func (*FileStatResponse) Err ¶ added in v0.2.2
func (r *FileStatResponse) Err() error
type IndexData ¶
type IndexData struct {
LoginDevices struct {
Last struct {
Device string `json:"device"`
DeviceId string `json:"device_id"`
Ip string `json:"ip"`
City string `json:"city"`
Os string `json:"os"`
Network string `json:"network"`
Time int64 `json:"utime"`
} `json:"last"`
List []LoginDeviceInfo `json:"list"`
} `json:"login_devices_info"`
Space struct {
Total SizeInfo `json:"all_total"`
Used SizeInfo `json:"all_use"`
Remain SizeInfo `json:"all_remain"`
} `json:"space_info"`
}
type LabelListData ¶
type LoginBasicResponse ¶
type LoginBasicResponse struct {
State int `json:"state"`
Code int `json:"code"`
Message string `json:"message"`
ErrorCode int `json:"errno"`
ErrorMessage string `json:"error"`
Data json.RawMessage `json:"data"`
}
func (*LoginBasicResponse) Decode ¶
func (r *LoginBasicResponse) Decode(data interface{}) error
func (*LoginBasicResponse) Err ¶
func (r *LoginBasicResponse) Err() error
type LoginCheckData ¶
type LoginCheckResponse ¶
type LoginCheckResponse struct {
LoginBasicResponse
}
func (*LoginCheckResponse) Err ¶
func (r *LoginCheckResponse) Err() error
type LoginDeviceInfo ¶
type LoginUserData ¶
type OfflineAddUrlResponse ¶
type OfflineAddUrlResponse struct {
OfflineBasicResponse
InfoHash string `json:"info_hash"`
Name string `json:"name"`
Url string `json:"url"`
}
type OfflineBasicResponse ¶
type OfflineBasicResponse struct {
State bool `json:"state"`
ErrorNum int `json:"errno"`
ErrorCode int `json:"errcode"`
}
func (*OfflineBasicResponse) Err ¶
func (r *OfflineBasicResponse) Err() error
type OfflineListResponse ¶
type OfflineListResponse struct {
OfflineBasicResponse
Tasks []*OfflineTask `json:"tasks"`
TaskCount int `json:"count"`
PageIndex int `json:"page"`
PageCount int `json:"page_count"`
PageSize int `json:"page_row"`
QuotaTotal int `json:"total"`
QuotaRemain int `json:"quota"`
}
type OfflineSpaceResponse ¶
type OfflineTask ¶
type OfflineTask struct {
InfoHash string `json:"info_hash"`
Name string `json:"name"`
Size int64 `json:"size"`
FileId string `json:"file_id"`
DirId string `json:"wp_path_id"`
Url string `json:"url"`
Status int `json:"status"`
Percent float64 `json:"percentDone"`
AddTime int64 `json:"add_time"`
UpdateTime int64 `json:"last_update"`
}
type OfflineToken ¶
type QrcodeStatusData ¶
type QrcodeTokenData ¶
type StringFloat64 ¶
type StringFloat64 float64
StringFloat64 uses for json field which maybe a string or a float64.
func (*StringFloat64) UnmarshalJSON ¶
func (v *StringFloat64) UnmarshalJSON(b []byte) (err error)
type StringInt ¶
type StringInt int64
StringInt uses for json field which maybe a string or an int.
func (*StringInt) UnmarshalJSON ¶
type StringInt64 ¶
type StringInt64 int64
StringInt64 uses for json field which maybe a string or an int64.
func (*StringInt64) UnmarshalJSON ¶
func (v *StringInt64) UnmarshalJSON(b []byte) (err error)
type UploadInfoResponse ¶
type UploadInitResponse ¶
type UploadInitResponse struct {
Request string `json:"request"`
ErrorCode int `json:"statuscode"`
ErrorMsg string `json:"statusmsg"`
Status BoolInt `json:"status"`
PickCode string `json:"pickcode"`
// OSS upload fields
Bucket string `json:"bucket"`
Object string `json:"object"`
Callback struct {
Callback string `json:"callback"`
CallbackVar string `json:"callback_var"`
} `json:"callback"`
// Useless fields
FileId int `json:"fileid"`
FileInfo string `json:"fileinfo"`
Target string `json:"target"`
}
func (*UploadInitResponse) Err ¶
func (r *UploadInitResponse) Err() error
type UploadOssParams ¶
type UploadOssTokenResponse ¶
type UploadOssTokenResponse struct {
StatusCode string `json:"StatusCode"`
AccessKeyId string `json:"AccessKeyId"`
AccessKeySecret string `json:"AccessKeySecret"`
SecurityToken string `json:"SecurityToken"`
Expiration string `json:"Expiration"`
}
func (*UploadOssTokenResponse) Err ¶
func (r *UploadOssTokenResponse) Err() error
type UploadResultData ¶
type UploadSimpleInitResponse ¶
type UploadSimpleInitResponse struct {
Host string `json:"host"`
Object string `json:"object"`
Callback string `json:"callback"`
AccessKeyId string `json:"accessid"`
Policy string `json:"policy"`
Expire int64 `json:"expire"`
Signature string `json:"signature"`
}
func (*UploadSimpleInitResponse) Err ¶
func (r *UploadSimpleInitResponse) Err() error
type UploadToken ¶
func (*UploadToken) Available ¶
func (t *UploadToken) Available() bool
type UserInfoData ¶
type UserInfoData struct {
UserId int `json:"user_id"`
UserName string `json:"user_name"`
UserAvatar string `json:"face"`
Device int `json:"device"`
Rank int `json:"rank"`
VipFlag int `json:"vip"`
VipExpire int64 `json:"expire"`
VipForever int `json:"forever"`
Global int `json:"global"`
IsPrivilege bool `json:"is_privilege"`
Privilege struct {
State bool `json:"state"`
Start int `json:"start"`
Expire int `json:"expire"`
} `json:"privilege"`
}
type VersionData ¶ added in v0.3.1
type VersionData struct {
Android VersionInfo `json:"android"`
LinuxApp VersionInfo `json:"linux_115"`
MacBrowser VersionInfo `json:"mac"`
MacApp VersionInfo `json:"mac_115"`
WinBrowser VersionInfo `json:"win"`
WinApp VersionInfo `json:"window_115"`
}
type VersionInfo ¶ added in v0.3.1
type VideoResponse ¶
type VideoResponse struct {
BasicResponse
// Video information
Width StringInt `json:"width"`
Height StringInt `json:"height"`
Duration StringFloat64 `json:"play_long"`
VideoUrl string `json:"video_url"`
// File information
FileId string `json:"file_id"`
FileName string `json:"file_name"`
FileSize StringInt64 `json:"file_size"`
FileStatus int `json:"file_status"`
PickCode string `json:"pick_code"`
Sha1 string `json:"sha1"`
}
Click to show internal directories.
Click to hide internal directories.