fish2018/pansou · error

详情页返回状态码

Error message

详情页返回状态码: %d

What it means

After a successful transport round-trip, fetchMagnetLink requires HTTP 200 from the detail page. Any other status code (403 anti-bot, 404 gone page, 5xx server errors, 30x leaking through) produces this error carrying the numeric status. It signals the site responded but not with the expected magnet page content.

Solutions

  1. Log the failing status code and URL; if it is 403/429, reduce MaxConcurrency and add delays between requests.
  2. Rotate User-Agent strings (the plugin already has a userAgents list) and consider adding cookie handling for anti-bot pages.
  3. Treat 404 as permanent: drop the result instead of retrying.
  4. Retry 5xx responses after a delay; they are often transient.
  5. Verify the client follows redirects appropriately for this site, or handle 30x explicitly.
Defensive patterns

Strategy: try-catch

Try / catch

magnet, err := p.fetchMagnetLink(client, detailURL)
var statusErr error
if err != nil && strings.Contains(err.Error(), "详情页返回状态码") {
    log.Printf("non-200 detail page (%s), will back off", detailURL)
    time.Sleep(2 * time.Second)
}

Prevention

When it happens

Trigger: The detail-page GET completed and returned a status other than 200 — e.g. 403/429 from anti-scraping or rate limiting, 404 for a deleted entry, 500/502/503 from the site, or a redirect the client did not follow.

Common situations: Too many concurrent enrichWithMagnetLinks requests triggering rate limiting (429); the site deploying Cloudflare/anti-bot challenges (403); search-result URLs pointing to pages removed since indexing; origin server outage (5xx).

Related errors


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

Appendix: source

Thrown at plugin/wuji/wuji.go:323

	// 创建请求
	req, err := http.NewRequestWithContext(ctx, "GET", detailURL, nil)
	if err != nil {
		return "", fmt.Errorf("创建详情页请求失败: %w", err)
	}
	
	// 设置请求头
	p.setRequestHeaders(req)
	
	// 发送HTTP请求
	resp, err := p.doRequestWithRetry(req, client)
	if err != nil {
		return "", fmt.Errorf("详情页请求失败: %w", err)
	}
	defer resp.Body.Close()
	
	// 检查状态码
	if resp.StatusCode != 200 {
		return "", fmt.Errorf("详情页返回状态码: %d", resp.StatusCode)
	}
	
	// 读取响应体内容
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return "", fmt.Errorf("读取详情页响应失败: %w", err)
	}
	
	// 解析HTML
	doc, err := goquery.NewDocumentFromReader(strings.NewReader(string(body)))
	if err != nil {
		return "", fmt.Errorf("详情页HTML解析失败: %w", err)
	}
	
	// 提取磁力链接
	magnetInput := doc.Find("input#input-magnet")
	if magnetInput.Length() == 0 {
		return "", fmt.Errorf("未找到磁力链接输入框")

View on GitHub (pinned to beaa561337)