lanzou

package
v3.20.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: AGPL-3.0 Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const DAY time.Duration = 84600000000000

Variables

View Source
var ErrFileNotExist = errors.New("file does not exist")
View Source
var ErrFileShareCancel = errors.New("file sharing cancellation")

Functions

func CalcAcwScV2

func CalcAcwScV2(html string) (string, error)

在页面被过多访问或其他情况下,有时候会先返回一个加密的页面,其执行计算出一个acw_sc__v2后放入页面后再重新访问页面才能获得正常页面 若该页面进行了js加密,则进行解密,计算acw_sc__v2,并加入cookie

func GetExpirationTime added in v3.9.0

func GetExpirationTime(url string) (etime time.Duration)

func HexXor

func HexXor(hex1, hex2 string) string

func IsNumber

func IsNumber(str string) bool

func MustParseTime

func MustParseTime(str string) time.Time

如果解析失败,则返回当前时间

func RemoveNotes

func RemoveNotes(html string) string

移除注释

func SizeStrToInt64

func SizeStrToInt64(size string) int64

解析失败返回0

func Unbox

func Unbox(hex string) string

Types

type Addition

type Addition struct {
	Type   string `json:"type" type:"select" options:"cookie,url" default:"cookie"`
	Cookie string `json:"cookie" required:"true" help:"about 15 days valid, ignore if shareUrl is used"`
	driver.RootID
	SharePassword  string `json:"share_password"`
	BaseUrl        string `json:"baseUrl" required:"true" default:"https://pc.woozooo.com" help:"basic URL for file operation"`
	ShareUrl       string `json:"shareUrl" required:"true" default:"https://pan.lanzouo.com" help:"used to get the sharing page"`
	RepairFileInfo bool   `json:"repair_file_info" help:"To use webdav, you need to enable it"`
}

func (*Addition) IsCookie

func (a *Addition) IsCookie() bool

type FileOrFolder

type FileOrFolder struct {
	Name string `json:"name"`

	// 文件通用
	ID      string `json:"id"`
	NameAll string `json:"name_all"`
	Size    string `json:"size"`
	Time    string `json:"time"`

	// 文件夹
	FolID string `json:"fol_id"`
	// contains filtered or unexported fields
}

func (*FileOrFolder) GetID added in v3.9.0

func (f *FileOrFolder) GetID() string

func (*FileOrFolder) GetName added in v3.9.0

func (f *FileOrFolder) GetName() string

func (*FileOrFolder) GetPath added in v3.9.0

func (f *FileOrFolder) GetPath() string

func (*FileOrFolder) GetShareInfo added in v3.9.0

func (f *FileOrFolder) GetShareInfo() *FileShare

func (*FileOrFolder) GetSize added in v3.9.0

func (f *FileOrFolder) GetSize() int64

func (*FileOrFolder) IsDir added in v3.9.0

func (f *FileOrFolder) IsDir() bool

func (*FileOrFolder) ModTime added in v3.9.0

func (f *FileOrFolder) ModTime() time.Time

func (*FileOrFolder) SetShareInfo added in v3.9.0

func (f *FileOrFolder) SetShareInfo(fs *FileShare)

type FileOrFolderByShareUrl

type FileOrFolderByShareUrl struct {
	ID      string `json:"id"`
	NameAll string `json:"name_all"`

	// 文件特有
	Duan string `json:"duan"`
	Size string `json:"size"`
	Time string `json:"time"`

	// 文件夹特有
	IsFloder bool `json:"-"`

	//
	Url string `json:"-"`
	Pwd string `json:"-"`
	// contains filtered or unexported fields
}

func (*FileOrFolderByShareUrl) GetID added in v3.9.0

func (f *FileOrFolderByShareUrl) GetID() string

func (*FileOrFolderByShareUrl) GetName added in v3.9.0

func (f *FileOrFolderByShareUrl) GetName() string

func (*FileOrFolderByShareUrl) GetPath added in v3.9.0

func (f *FileOrFolderByShareUrl) GetPath() string

func (*FileOrFolderByShareUrl) GetSize added in v3.9.0

func (f *FileOrFolderByShareUrl) GetSize() int64

func (*FileOrFolderByShareUrl) IsDir added in v3.9.0

func (f *FileOrFolderByShareUrl) IsDir() bool

func (*FileOrFolderByShareUrl) ModTime added in v3.9.0

func (f *FileOrFolderByShareUrl) ModTime() time.Time

type FileOrFolderByShareUrlResp

type FileOrFolderByShareUrlResp struct {
	Text []FileOrFolderByShareUrl `json:"text"`
}

分享类型为文件夹

type FileShare

type FileShare struct {
	Pwd    string `json:"pwd"`
	Onof   string `json:"onof"`
	Taoc   string `json:"taoc"`
	IsNewd string `json:"is_newd"`

	// 文件
	FID string `json:"f_id"`

	// 文件夹
	NewUrl string `json:"new_url"`
	Name   string `json:"name"`
	Des    string `json:"des"`
}

通过ID获取文件/文件夹分享信息

type FileShareInfoAndUrlResp

type FileShareInfoAndUrlResp[T string | int] struct {
	Dom string `json:"dom"`
	URL string `json:"url"`
	Inf T      `json:"inf"`
}

获取下载链接的响应

func (*FileShareInfoAndUrlResp[T]) GetBaseUrl

func (u *FileShareInfoAndUrlResp[T]) GetBaseUrl() string

func (*FileShareInfoAndUrlResp[T]) GetDownloadUrl

func (u *FileShareInfoAndUrlResp[T]) GetDownloadUrl() string

type LanZou

type LanZou struct {
	Addition
	model.Storage
	// contains filtered or unexported fields
}

func (*LanZou) Config

func (d *LanZou) Config() driver.Config

func (*LanZou) Drop

func (d *LanZou) Drop(ctx context.Context) error

func (*LanZou) GetAddition

func (d *LanZou) GetAddition() driver.Additional

func (*LanZou) GetAllFiles added in v3.9.0

func (d *LanZou) GetAllFiles(folderID string) ([]model.Obj, error)

获取文件和文件夹,获取到的文件大小、更改时间不可信

func (*LanZou) GetFileOrFolderByShareUrl

func (d *LanZou) GetFileOrFolderByShareUrl(shareID, pwd string) ([]model.Obj, error)

通过分享链接获取文件或文件夹

func (*LanZou) GetFiles

func (d *LanZou) GetFiles(folderID string) ([]FileOrFolder, error)

通过ID获取文件

func (*LanZou) GetFilesByShareUrl added in v3.9.0

func (d *LanZou) GetFilesByShareUrl(shareID, pwd string) (file *FileOrFolderByShareUrl, err error)

通过分享链接获取文件(下载链接也使用此方法) FileOrFolderByShareUrl 包含 pwd 和 url 字段 参考 https://github.com/zaxtyson/LanZouCloud-API/blob/ab2e9ec715d1919bf432210fc16b91c6775fbb99/lanzou/api/core.py#L440

func (*LanZou) GetFolderByShareUrl added in v3.9.0

func (d *LanZou) GetFolderByShareUrl(shareID, pwd string) ([]FileOrFolderByShareUrl, error)

通过分享链接获取文件夹 似乎子目录和文件不会加密 参考 https://github.com/zaxtyson/LanZouCloud-API/blob/ab2e9ec715d1919bf432210fc16b91c6775fbb99/lanzou/api/core.py#L1089

func (*LanZou) GetFolders added in v3.9.0

func (d *LanZou) GetFolders(folderID string) ([]FileOrFolder, error)

通过ID获取文件夹

func (*LanZou) Init

func (d *LanZou) Init(ctx context.Context) (err error)
func (d *LanZou) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)

func (*LanZou) List

func (d *LanZou) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error)

获取的大小和时间不准确

func (*LanZou) MakeDir

func (d *LanZou) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) (model.Obj, error)

func (*LanZou) Move

func (d *LanZou) Move(ctx context.Context, srcObj, dstDir model.Obj) (model.Obj, error)

func (*LanZou) Put

func (d *LanZou) Put(ctx context.Context, dstDir model.Obj, stream model.FileStreamer, up driver.UpdateProgress) (model.Obj, error)

func (*LanZou) Remove

func (d *LanZou) Remove(ctx context.Context, obj model.Obj) error

func (*LanZou) Rename

func (d *LanZou) Rename(ctx context.Context, srcObj model.Obj, newName string) (model.Obj, error)

type RespInfo added in v3.9.0

type RespInfo[T any] struct {
	Info T `json:"info"`
}

type RespText added in v3.9.0

type RespText[T any] struct {
	Text T `json:"text"`
}

Jump to

Keyboard shortcuts

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