fish2018/pansou · error
验证页面地址无效
Error message
验证页面地址无效: %w
What it means
After extracting the verification endpoint path, solveVerification parses the original page URL with url.Parse. If the pageURL is malformed (unparseable scheme/host), the plugin cannot construct the verification endpoint URL and wraps the url.Parse error in this message.
Solutions
- Validate the URL with url.Parse before calling searchSuggest/getDetailInfo and reject malformed input
- Ensure URLs are passed in encoded form and never manually decoded before use
- Inspect the wrapped %w error to see the exact parse failure from net/url
Example fix
// before
info, err := plugin.GetDetailInfo(ctx, rawURL)
// after
if _, err := url.Parse(rawURL); err != nil {
return fmt.Errorf("invalid detail url: %w", err)
}
info, err := plugin.GetDetailInfo(ctx, rawURL) Defensive patterns
Strategy: validation
Validate before calling
u, err := url.Parse(rawURL)
if err != nil || u.Scheme == "" || u.Host == "" {
return fmt.Errorf("invalid detail url: %w", err)
} Try / catch
info, err := plugin.GetDetailInfo(ctx, url)
if err != nil && strings.Contains(err.Error(), "验证页面地址无效") {
return fmt.Errorf("skip malformed url %s: %w", url, err)
} Prevention
- Validate all URLs with url.Parse before passing them to the plugin
- Never hand plugin code raw, unencoded URLs from user input
- Reject scheme-relative (//host) URLs unless normalized to https first
When it happens
Trigger: url.Parse(pageURL) returns an error inside solveVerification; practically only when a caller passed a malformed detail/suggest URL (e.g. containing invalid characters or no scheme) that earlier normalization let through.
Common situations: User-supplied or crawled detail URL containing control characters or spaces; URLs assembled by string concatenation without validation upstream; proxy-passthrough code passing an already-decoded/mangled URL.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07).
Data as JSON: /api/errors/75d99eb6650f3521.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/qiwei/qiwei.go:376
if err != nil {
return fmt.Errorf("获取验证脚本失败: %w", err)
}
typeMatch := verificationTypeRegex.FindStringSubmatch(jsBody)
keyMatch := verificationKeyRegex.FindStringSubmatch(jsBody)
valueMatch := verificationValueRegex.FindStringSubmatch(jsBody)
if len(typeMatch) < 2 || len(keyMatch) < 2 || len(valueMatch) < 2 {
return fmt.Errorf("验证脚本参数不完整")
}
encodedValue := md5StringToHex(valueMatch[1])
endpointPath := "/a20be899_96a6_40b2_88ba_32f1f75f1552_yanzheng_huadong.php"
if endpointMatch := verificationEndpointRegex.FindStringSubmatch(jsBody); len(endpointMatch) > 1 {
endpointPath = "/" + endpointMatch[1]
}
parsedPage, err := url.Parse(pageURL)
if err != nil {
return fmt.Errorf("验证页面地址无效: %w", err)
}
verifyURL := (&url.URL{Scheme: parsedPage.Scheme, Host: parsedPage.Host, Path: endpointPath}).String()
query := url.Values{}
query.Set("type", typeMatch[1])
query.Set("key", keyMatch[1])
query.Set("value", encodedValue)
verifyURL += "?" + query.Encode()
ctx, cancel := context.WithTimeout(context.Background(), detailTimeout)
defer cancel()
req, err := http.NewRequestWithContext(ctx, http.MethodGet, verifyURL, nil)
if err != nil {
return fmt.Errorf("创建验证请求失败: %w", err)
}
p.setHeaders(req, pageURL)
req.Header.Set("X-Requested-With", "XMLHttpRequest")
resp, err := p.doRequestWithRetry(req, client)
if err != nil {View on GitHub (pinned to beaa561337)