fish2018/pansou · error
获取搜索结果失败
Error message
获取搜索结果失败: %w
What it means
After extracting the redirect target, xb6v's searchImpl performs a second GET to the search-results URL (e.g. /e/search/result/?searchid=N). Any transport-level failure of that request is wrapped as this error. It indicates the results page could not be fetched at all — not a bad status code (that's a separate error).
Solutions
- Retry the search — result pages often expire or the connection may be transiently unavailable.
- Open the resultURL printed in debug logs in a browser to check if the mirror is reachable at all.
- Check proxy/firewall/DNS settings for the plugin's configured base host.
- Reconfigure to a working mirror base URL if the current one is defunct.
Defensive patterns
Strategy: retry
Validate before calling
resp, err := http.Head(mirrorBase); if err != nil || resp.StatusCode != 200 { /* mirror unreachable — pick another */ } Try / catch
results, err := pluginSearch(keyword)
if err != nil && strings.Contains(err.Error(), "获取搜索结果失败") {
if errors.Is(err, context.DeadlineExceeded) || isNetError(err) {
// retry once, then fail over to another mirror
}
} Prevention
- Check mirror availability before searches.
- Configure multiple mirrors for failover.
- Ensure DNS and proxy settings permit access to the mirror host.
When it happens
Trigger: p.doRequest GET on resultURL fails: DNS resolution failure, TCP connect refused/timeout, TLS error, or the request context/transport returned an error for the second-hop results page.
Common situations: The mirror's result path is behind a different host that's down; the searchid expired quickly and the server dropped the connection; corporate proxy blocks the second URL; DNS for the mirror intermittently fails.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07).
Data as JSON: /api/errors/262b2bee18239747.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/xb6v/xb6v.go:287
}
// 构建完整的搜索结果URL
// Location通常是类似 "result/?searchid=39616" 的格式,需要加上 /e/search/ 前缀
var resultURL string
if strings.HasPrefix(location, "result/") {
resultURL = p.currentBase + "/e/search/" + location
} else {
resultURL = p.currentBase + "/" + strings.TrimPrefix(location, "/")
}
if p.debugMode {
log.Printf("[Xb6v] 搜索结果页面: %s", resultURL)
}
// 第二步:获取搜索结果页面
resp2, err := p.doRequest(client, "GET", resultURL, "", p.currentBase)
if err != nil {
return nil, fmt.Errorf("获取搜索结果失败: %w", err)
}
defer resp2.Body.Close()
if resp2.StatusCode != http.StatusOK {
return nil, fmt.Errorf("搜索结果响应状态码异常: %d", resp2.StatusCode)
}
// 解析搜索结果页面
reader, err := p.getResponseReader(resp2)
if err != nil {
return nil, err
}
doc, err := goquery.NewDocumentFromReader(reader)
if err != nil {
return nil, fmt.Errorf("解析搜索结果HTML失败: %w", err)
}
View on GitHub (pinned to beaa561337)