{"record":{"id":"7a866687ccc7df88","repo":"AlistGo/alist","slug":"not-find-file-sgin","errorCode":null,"errorMessage":"not find file sgin","messagePattern":"not find file sgin","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/lanzou/help.go","lineNumber":296,"sourceCode":"\treturn param\n}\n\nfunc IsNumber(str string) bool {\n\tfor _, s := range str {\n\t\tif !unicode.IsDigit(s) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}\n\nvar findFromReg = regexp.MustCompile(`data : '(.+?)'`) // 查找from字符串\n\n// 解析html中的form\nfunc htmlFormToMap(html string) (map[string]string, error) {\n\tforms := findFromReg.FindStringSubmatch(html)\n\tif len(forms) != 2 {\n\t\treturn nil, fmt.Errorf(\"not find file sgin\")\n\t}\n\treturn formToMap(forms[1]), nil\n}\n\nfunc formToMap(from string) map[string]string {\n\tvar param = make(map[string]string)\n\tfor _, kv := range strings.Split(from, \"&\") {\n\t\tkv := strings.SplitN(kv, \"=\", 2)[:2]\n\t\tparam[kv[0]] = kv[1]\n\t}\n\treturn param\n}\n\nvar regExpirationTime = regexp.MustCompile(`e=(\\d+)`)\n\nfunc GetExpirationTime(url string) (etime time.Duration) {\n\texps := regExpirationTime.FindStringSubmatch(url)\n\tif len(exps) < 2 {","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/drivers/lanzou/help.go#L278-L314","documentation":"htmlFormToMap fails when the regex `data : '(.+?)'` finds no form payload in the LanZou HTML. Despite the typo ('sgin'), this is the 'file sign' — the encoded form parameters the driver must repost to reach the download page. Its absence means the expected intermediate page was not returned.","triggerScenarios":"Requesting the file-sign step of a LanZou download where the returned page is not the expected form page: an error/verification page, a challenge page, or a template where the data-payload marker changed.","commonSituations":"LanZou download flow altered (extra verification step, sliding captcha); share link invalid/deleted; rate-limit block page returned mid-flow; frontend update changing whitespace so `data : '...'` no longer matches.","solutions":["Open the share link in a browser and walk the download flow manually to see the new steps (captcha/verification)","Wait and retry later if the block is rate-limit based","Update OpenList — the regex is periodically adjusted for LanZou changes; report HTML otherwise"],"exampleFix":"// before\nvar findFromReg = regexp.MustCompile(`data : '(.+?)'`)\n// after (tolerate formatting drift in the marker)\nvar findFromReg = regexp.MustCompile(`data\\s*:\\s*'(.+?)'`)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func hasLanzouFormSign(html string) bool {\n    return findFromReg.MatchString(html)\n}","tryCatchPattern":"params, err := htmlFormToMap(html)\nif err != nil {\n    if !hasLanzouFormSign(html) {\n        return nil, fmt.Errorf(\"intermediate download page missing sign payload (new verification step?): %w\", err)\n    }\n    return nil, err\n}","preventionTips":["Walk the download flow in a browser periodically to detect new captcha/verification steps","Rate-limit to avoid block pages mid-flow","Loosen marker regexes to tolerate whitespace drift when maintaining a fork"],"tags":["lanzou","scraping","parsing","dom-change","openlist"],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}