From 31a033dff1c5513ab3edb251f2def78ede653fc0 Mon Sep 17 00:00:00 2001 From: Myth Date: Thu, 24 Aug 2023 21:56:20 +0800 Subject: [PATCH] fix(lanzou): download cannot find data (#5088) --- drivers/lanzou/help.go | 14 +++++++++++++- drivers/lanzou/util.go | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/lanzou/help.go b/drivers/lanzou/help.go index f5b8ce42b9a..31a558e9c75 100644 --- a/drivers/lanzou/help.go +++ b/drivers/lanzou/help.go @@ -118,7 +118,19 @@ var findKVReg = regexp.MustCompile(`'(.+?)':('?([^' },]*)'?)`) // 拆分kv // 根据key查询js变量 func findJSVarFunc(key, data string) string { - values := regexp.MustCompile(`var ` + key + ` = '(.+?)';`).FindStringSubmatch(data) + var values []string + if key != "sasign" { + values = regexp.MustCompile(`var ` + key + ` = '(.+?)';`).FindStringSubmatch(data) + } else { + matches := regexp.MustCompile(`var `+key+` = '(.+?)';`).FindAllStringSubmatch(data, -1) + if len(matches) == 3 { + values = matches[1] + } else { + if len(matches) > 0 { + values = matches[0] + } + } + } if len(values) == 0 { return "" } diff --git a/drivers/lanzou/util.go b/drivers/lanzou/util.go index 272cbbfe2bd..e6e366a34e3 100644 --- a/drivers/lanzou/util.go +++ b/drivers/lanzou/util.go @@ -374,7 +374,7 @@ func (d *LanZou) getFilesByShareUrl(shareID, pwd string, sharePageData string) ( if err != nil { return nil, err } - nextPageData := removeJSGlobalFunction(RemoveNotes(string(data))) + nextPageData := RemoveNotes(string(data)) param, err = htmlJsonToMap(nextPageData) if err != nil { return nil, err