{"record":{"id":"a203198dc79f066d","repo":"fish2018/pansou","slug":"token-a20319","errorCode":null,"errorMessage":"盘链 token 未解析出真实链接","messagePattern":"盘链 token 未解析出真实链接","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/panlian/panlian.go","lineNumber":979,"sourceCode":"\t}\n\tdefer resp.Body.Close()\n\tif location := strings.TrimSpace(resp.Header.Get(\"Location\")); isRealPanURL(location) {\n\t\treturn decodePanURL(location), nil\n\t}\n\tbody, err := io.ReadAll(io.LimitReader(resp.Body, 1<<20))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tfor _, pattern := range panTokenURLRegexes {\n\t\tmatch := pattern.FindSubmatch(body)\n\t\tif len(match) > 1 {\n\t\t\tresolvedURL := decodePanURL(string(match[1]))\n\t\t\tif isRealPanURL(resolvedURL) {\n\t\t\t\treturn resolvedURL, nil\n\t\t\t}\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"盘链 token 未解析出真实链接\")\n}\n\nfunc decodePanURL(value string) string {\n\tvalue = html.UnescapeString(strings.TrimSpace(value))\n\treturn strings.ReplaceAll(value, `\\/`, `/`)\n}\n\nfunc (p *PanlianPlugin) setPanlianHeaders(req *http.Request, cookie string, referer string) {\n\treq.Header.Set(\"User-Agent\", browserUserAgent())\n\treq.Header.Set(\"X-Requested-With\", \"XMLHttpRequest\")\n\treq.Header.Set(\"Accept\", \"application/json, text/plain, */*\")\n\treq.Header.Set(\"Accept-Language\", \"zh-TW,zh;q=0.9,zh-CN;q=0.8,en;q=0.7\")\n\treq.Header.Set(\"Origin\", DefaultBaseURL)\n\treq.Header.Set(\"Referer\", referer)\n\tif cookie != \"\" {\n\t\treq.Header.Set(\"Cookie\", cookie)\n\t}\n}","sourceCodeStart":961,"sourceCodeEnd":997,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/panlian/panlian.go#L961-L997","documentation":"resolvePanToken returns '盘链 token 未解析出真实链接' ('panlian token did not resolve to a real link') after fetching/decoding the token page failed to yield a string passing isRealPanURL. The token exists but the real pan URL could not be extracted from the resolution response.","triggerScenarios":"The token resolution HTTP call succeeds but the page/JSON contains no recognizable pan URL (regex misses), the token is stale/revoked, decodePanURL output fails isRealPanURL, or the upstream changed its redirect/embed format.","commonSituations":"Deleted or expired panlian shares; panlian changed its HTML/JS so the extraction regex no longer matches; anti-bot serving an interstitial instead of the link page; token pointing to a supported-but-changed pan host.","solutions":["Log the raw resolution response for the failing token and compare against the extraction regex; update the pattern if the format changed.","Verify the token resolves in a browser — if not, the share is dead; skip the entry.","Extend isRealPanURL to cover pan hosts panlian now emits.","Add retry with a fresh client in case the first fetch was served an anti-bot page."],"exampleFix":"// before\nreturn \"\", fmt.Errorf(\"盘链 token 未解析出真实链接\")\n// after\nreturn \"\", fmt.Errorf(\"盘链 token 未解析出真实链接 (token=%s, body=%.200s)\", token, lastBody)","handlingStrategy":"fallback","validationCode":"// sanity-check token before spending a resolution request\nif token == \"\" || len(token) > 2048 {\n    return fmt.Errorf(\"malformed panlian token\")\n}","typeGuard":null,"tryCatchPattern":"url, err := plugin.ResolveToken(ctx, token)\nif err != nil && strings.Contains(err.Error(), \"未解析出真实链接\") {\n    log.Printf(\"token unresolved (possibly dead share): %v\", err)\n    return nil // degrade gracefully, keep other links\n}","preventionTips":["Cache successful token resolutions to reduce dependence on flaky resolution calls.","Update extraction regexes whenever panlian changes its page structure.","Keep isRealPanURL's pan-host list current.","Skip tokens that fail resolution twice and report them as dead shares."],"tags":["scraping","token","url-resolution","upstream-api"],"backgroundTag":"unexpected-response-shape","analyzedSha":"beaa56133755a548ebc51b090b3816e2ae044aa6","analyzedAt":"2026-09-07T00:31:18.025Z","contentChangedAt":"2026-09-07T00:31:18.025Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}