fish2018/pansou · error

解析HTML失败

Error message

解析HTML失败: %v

What it means

Wrapped parse error in PantaAsyncPlugin.doSearch (plugin/panta/panta.go:275): the 200 search page could not be parsed by goquery — typically a non-HTML body (challenge or error page) despite the OK status.

Solutions

  1. 检查响应 Content-Type 与编码
  2. 解析前嗅探内容类型
  3. 记录原始响应排查网关改写
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at plugin/panta/panta.go:275 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/674ddb7de773bb3d. Report an issue: GitHub.

Appendix: source

Thrown at plugin/panta/panta.go:275

	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, fmt.Errorf("请求PanTa搜索页面失败: %v", err)
	}
	defer resp.Body.Close()
	
	// 检查状态码
	if resp.StatusCode != http.StatusOK {
		return nil, fmt.Errorf("请求PanTa搜索页面失败,状态码: %d", resp.StatusCode)
	}
	
	// 使用goquery解析HTML
	doc, err := goquery.NewDocumentFromReader(resp.Body)
	if err != nil {
		return nil, fmt.Errorf("解析HTML失败: %v", err)
	}
	
	// 解析搜索结果
	results, err := p.parseSearchResults(doc, client)
	if err != nil {
		return nil, err
	}
	
	// 使用过滤功能过滤结果
	filteredResults := plugin.FilterResultsByKeyword(results, keyword)
	
	return filteredResults, nil
}

// parseSearchResults 使用goquery解析搜索结果
func (p *PantaAsyncPlugin) parseSearchResults(doc *goquery.Document, client *http.Client) ([]model.SearchResult, error) {
	var results []model.SearchResult
	

View on GitHub (pinned to beaa561337)