fish2018/pansou · error

搜索结果响应状态码异常

Error message

搜索结果响应状态码异常: %d

What it means

xb6v's searchImpl requires the second-hop search-results GET to return HTTP 200. Any other status code (404, 403, 500, 302 to captcha, etc.) triggers this error with the numeric status. It signals the results page exists logically but the server refused or failed to serve it.

Solutions

  1. Retry with a fresh search — the searchid may have expired or the failure may be transient.
  2. Log the resultURL (debug mode) and test it in a browser to see whether the path is valid.
  3. Check for 403/429 and back off / rotate the mirror if the site is rate limiting.
  4. Verify the base URL configuration so /e/search/ prefix resolves on the configured mirror.

Example fix

// before
if resp2.StatusCode != http.StatusOK {
	return nil, fmt.Errorf("搜索结果响应状态码异常: %d", resp2.StatusCode)
}
// after: treat 404 as expired searchid and signal a clean retry
if resp2.StatusCode == http.StatusNotFound {
	return nil, fmt.Errorf("搜索结果已过期(searchid失效),请重新搜索")
}
if resp2.StatusCode != http.StatusOK {
	return nil, fmt.Errorf("搜索结果响应状态码异常: %d", resp2.StatusCode)
}
Defensive patterns

Strategy: retry

Validate before calling

// probe the search endpoint before searching
resp, err := client.Get(baseURL + "/e/search/"); if err == nil && resp.StatusCode == 403 { /* blocked — back off */ }

Try / catch

results, err := pluginSearch(keyword)
if err != nil {
	var statusErr interface{ Error() string }
	if strings.Contains(err.Error(), "搜索结果响应状态码异常") {
		// extract status, back off on 403/429, fail over on 404/5xx
	}
}

Prevention

When it happens

Trigger: GET to the constructed resultURL (currentBase + /e/search/result/?searchid=N) returns a non-200 status: expired/invalid searchid (404), anti-bot blocking (403), server error (5xx), or a redirect to a challenge page.

Common situations: Stale searchid reused after the server pruned search sessions; rate limiting by the mirror returning 403/429; mirror misconfiguration causing the wrong path prefix so the result URL 404s; temporary 5xx during mirror maintenance.

Related errors


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

Appendix: source

Thrown at plugin/xb6v/xb6v.go:292

	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)
	}

	// 提取搜索结果(详情页链接和日期)
	detailPages := p.extractDetailURLs(doc)

	if p.debugMode {
		log.Printf("[Xb6v] 找到 %d 个详情页链接", len(detailPages))

View on GitHub (pinned to beaa561337)