Skip to content
This repository was archived by the owner on Jun 22, 2025. It is now read-only.

Commit b8bd14f

Browse files
authored
fix(lanzou): missing parameter (AlistGo#7678 close AlistGo#7210)
1 parent 331885e commit b8bd14f

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

drivers/lanzou/help.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ var findKVReg = regexp.MustCompile(`'(.+?)':('?([^' },]*)'?)`) // 拆分kv
120120
func findJSVarFunc(key, data string) string {
121121
var values []string
122122
if key != "sasign" {
123-
values = regexp.MustCompile(`var ` + key + ` = '(.+?)';`).FindStringSubmatch(data)
123+
values = regexp.MustCompile(`var ` + key + `\s*=\s*['"]?(.+?)['"]?;`).FindStringSubmatch(data)
124124
} else {
125-
matches := regexp.MustCompile(`var `+key+` = '(.+?)';`).FindAllStringSubmatch(data, -1)
125+
matches := regexp.MustCompile(`var `+key+`\s*=\s*['"]?(.+?)['"]?;`).FindAllStringSubmatch(data, -1)
126126
if len(matches) == 3 {
127127
values = matches[1]
128128
} else {

drivers/lanzou/util.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ var findSubFolderReg = regexp.MustCompile(`(?i)(?:folderlink|mbxfolder).+href="/
264264
// 获取下载页面链接
265265
var findDownPageParamReg = regexp.MustCompile(`<iframe.*?src="(.+?)"`)
266266

267+
// 获取文件ID
268+
var findFileIDReg = regexp.MustCompile(`'/ajaxm\.php\?file=(\d+)'`)
269+
267270
// 获取分享链接主界面
268271
func (d *LanZou) getShareUrlHtml(shareID string) (string, error) {
269272
var vs string
@@ -356,8 +359,16 @@ func (d *LanZou) getFilesByShareUrl(shareID, pwd string, sharePageData string) (
356359
return nil, err
357360
}
358361
param["p"] = pwd
362+
363+
fileIDs := findFileIDReg.FindStringSubmatch(sharePageData)
364+
var fileID string
365+
if len(fileIDs) > 1 {
366+
fileID = fileIDs[1]
367+
} else {
368+
return nil, fmt.Errorf("not find file id")
369+
}
359370
var resp FileShareInfoAndUrlResp[string]
360-
_, err = d.post(d.ShareUrl+"/ajaxm.php", func(req *resty.Request) { req.SetFormData(param) }, &resp)
371+
_, err = d.post(d.ShareUrl+"/ajaxm.php?file="+fileID, func(req *resty.Request) { req.SetFormData(param) }, &resp)
361372
if err != nil {
362373
return nil, err
363374
}
@@ -381,8 +392,15 @@ func (d *LanZou) getFilesByShareUrl(shareID, pwd string, sharePageData string) (
381392
return nil, err
382393
}
383394

395+
fileIDs := findFileIDReg.FindStringSubmatch(nextPageData)
396+
var fileID string
397+
if len(fileIDs) > 1 {
398+
fileID = fileIDs[1]
399+
} else {
400+
return nil, fmt.Errorf("not find file id")
401+
}
384402
var resp FileShareInfoAndUrlResp[int]
385-
_, err = d.post(d.ShareUrl+"/ajaxm.php", func(req *resty.Request) { req.SetFormData(param) }, &resp)
403+
_, err = d.post(d.ShareUrl+"/ajaxm.php?file="+fileID, func(req *resty.Request) { req.SetFormData(param) }, &resp)
386404
if err != nil {
387405
return nil, err
388406
}

0 commit comments

Comments
 (0)