fish2018/pansou · error

[ ] 搜索验证失败

Error message

[%s] 搜索验证失败: %w

What it means

Raised in searchSuggest (plugin/qiwei/qiwei.go:197) when the suggest endpoint returns an anti-bot verification page, the plugin attempts automatic verification via solveVerification, and that attempt fails. The underlying solver error is wrapped with %w so the root cause (regex mismatch, failed POST, cookie rejection) is preserved. The plugin then aborts this host, letting searchSuggestWithFallback try the next mirror.

Solutions

  1. Inspect the wrapped cause (%w chain) to see whether it was HTTP failure or regex/non-match failure in solveVerification.
  2. Fetch the page manually and compare against the verificationScriptRegex/key/value/endpoint regexes; update them if the site changed its challenge page.
  3. Slow down request rate or add a proxy so the IP is not persistently challenged.
  4. Wait for cooldown — verification usually clears once the cookie jar gets a valid session; consider clearing cookies/restarting.
Defensive patterns

Strategy: retry

Validate before calling

// before searching, detect a verification page early
func looksLikeVerifyPage(body string) bool {
    return strings.Contains(body, "_yanzheng_huadong") || strings.Contains(body, "huadong_")
}

Try / catch

items, err := p.searchSuggest(client, host, keyword)
if err != nil && strings.Contains(err.Error(), "搜索验证失败") {
    time.Sleep(2 * time.Second) // back off, then try next mirror
    continue
}

Prevention

When it happens

Trigger: isVerifyPage(body) is true for the first fetchBody of /index.php/ajax/suggest (detected by the huadong verification-script regexes), and solveVerification cannot complete the challenge — e.g. the page HTML does not match verificationKeyRegex/verificationValueRegex/verificationEndpointRegex, or the verification POST fails.

Common situations: The site upgraded its anti-bot JS so the plugin's hardcoded regexes no longer match; the server IP is flagged and issued hard challenges; request bursts from enrichResults trip rate limiting into permanent verification mode.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07). Data as JSON: /api/errors/38c2c0a8430f160d. Report an issue: GitHub.

Appendix: source

Thrown at plugin/qiwei/qiwei.go:197

		}
		lastErr = err
	}

	if lastErr == nil {
		lastErr = fmt.Errorf("[%s] 所有域名均不可用", p.Name())
	}
	return nil, "", lastErr
}

func (p *QiweiPlugin) searchSuggest(client *http.Client, host, keyword string) ([]suggestItem, error) {
	searchURL := fmt.Sprintf("%s/index.php/ajax/suggest?mid=1&limit=%d&wd=%s", host, searchSuggestLimit, url.QueryEscape(keyword))
	body, err := p.fetchBody(client, searchURL, host+"/", searchTimeout)
	if err != nil {
		return nil, err
	}
	if isVerifyPage(body) {
		if err := p.solveVerification(client, searchURL, body); err != nil {
			return nil, fmt.Errorf("[%s] 搜索验证失败: %w", p.Name(), err)
		}
		body, err = p.fetchBody(client, searchURL, host+"/", searchTimeout)
		if err != nil {
			return nil, err
		}
		if isVerifyPage(body) {
			return nil, fmt.Errorf("[%s] 命中验证页: %s", p.Name(), host)
		}
	}

	var resp suggestResponse
	if err := json.Unmarshal([]byte(body), &resp); err != nil {
		return nil, fmt.Errorf("[%s] suggest 响应解析失败: %w", p.Name(), err)
	}

	if resp.Code != 1 && len(resp.List) == 0 {
		return nil, fmt.Errorf("[%s] suggest 响应异常: host=%s code=%d msg=%s", p.Name(), host, resp.Code, resp.Msg)
	}

View on GitHub (pinned to beaa561337)