fish2018/pansou · error

搜索结果请求失败,状态码

Error message

搜索结果请求失败,状态码: %d

What it means

getSearchResults fetches the search-results page after obtaining a searchid and requires HTTP 200. Any other status code aborts with this error naming the actual status. It signals the results request failed at the HTTP level (rate limiting, blocking, server error, expired searchid).

Solutions

  1. Log the status code and retry with backoff for transient codes (429, 5xx) — the surrounding code already retries, so check retry limits.
  2. Inspect whether the searchid is being used promptly after retrieval; re-fetch it if it expired.
  3. Add realistic headers (User-Agent, Referer, cookies) to avoid 403 anti-bot responses.
  4. Check upstream availability directly (curl -i) to distinguish blocking from an outage.
Defensive patterns

Strategy: retry

Try / catch

var res []model.SearchResult
err := retry(3, time.Second, func() error {
    var e error
    res, e = client.SearchWithResult(ctx, keyword)
    return e
})
if err != nil {
    // all attempts got non-200: surface status or switch upstream
}

Prevention

When it happens

Trigger: SearchWithResult proceeds to getSearchResults and the results request returns a non-200 status, e.g. 403 (anti-bot), 404 (expired/invalid searchid), 429 (rate limit), or 5xx.

Common situations: Too-frequent searches trigger rate limiting; the searchid expired between the two requests; the site blocks datacenter IPs; upstream outage returning 502/503.

Related errors


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

Appendix: source

Thrown at plugin/clxiong/clxiong.go:233

		resp, lastErr = client.Do(req)
		if lastErr == nil && resp.StatusCode == 200 {
			break
		}
		if resp != nil {
			resp.Body.Close()
		}
		if i < MaxRetries-1 {
			time.Sleep(RetryDelay)
		}
	}

	if lastErr != nil {
		return nil, lastErr
	}
	defer resp.Body.Close()

	if resp.StatusCode != 200 {
		return nil, fmt.Errorf("搜索结果请求失败,状态码: %d", resp.StatusCode)
	}

	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}

	return p.parseSearchResults(string(body))
}

// parseSearchResults 解析搜索结果页面
func (p *ClxiongPlugin) parseSearchResults(html string) ([]model.SearchResult, error) {
	doc, err := goquery.NewDocumentFromReader(strings.NewReader(html))
	if err != nil {
		return nil, err
	}

	var results []model.SearchResult

View on GitHub (pinned to beaa561337)