fish2018/pansou · error

请求帖子详情页失败,状态码

Error message

请求帖子详情页失败,状态码: %d

What it means

Status error in panta's fetchThreadLinks (plugin/panta/panta.go:629): the thread detail page returned a non-200 status after retries, so its links cannot be extracted. The search worked but the per-post fetch was rejected.

Solutions

  1. 对单个详情页失败做降级,保留搜索层结果
  2. 确认是否需要登录 Cookie
  3. 对该帖子记录跳过原因
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at plugin/panta/panta.go:629 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at plugin/panta/panta.go:629

	// 设置User-Agent和Referer
	req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36")
	req.Header.Set("Referer", "https://www.91panta.cn/index")
	req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
	req.Header.Set("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8")
	req.Header.Set("Connection", "keep-alive")
	req.Header.Set("Upgrade-Insecure-Requests", "1")
	req.Header.Set("Cache-Control", "max-age=0")
	
	// 使用带重试的请求方法发送HTTP请求
	resp, err := p.doRequestWithRetry(req, client)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	
	// 检查状态码
	if resp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("请求帖子详情页失败,状态码: %d", resp.StatusCode)
	}
	
	// 使用goquery解析HTML
	doc, err := goquery.NewDocumentFromReader(resp.Body)
	if err != nil {
		return nil, fmt.Errorf("解析HTML失败: %v", err)
	}
	
	// 提取标题
	title := strings.TrimSpace(doc.Find("div.title").Text())
	
	// 从标题中提取年份作为可能的提取码
	var yearFromTitle string
	yearMatch := yearRegex.FindStringSubmatch(title)
	if len(yearMatch) >= 2 {
		yearFromTitle = yearMatch[1]
	}
	

View on GitHub (pinned to beaa561337)