fish2018/pansou · error

[ ] 创建详情请求失败

Error message

[%s] 创建详情请求失败: %w

What it means

http.NewRequestWithContext rejected a yulinshufa detail URL taken from search results (item.DetailURL). Fires on malformed scraped links — a bad href captured during list parsing. Not a network failure.

Solutions

  1. Validate/absolutize scraped hrefs at extraction time
  2. Skip items with unparseable detail URLs
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at plugin/yulinshufa/yulinshufa.go:312 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/41bd9b9f9a5b2499. Report an issue: GitHub.

Appendix: source

Thrown at plugin/yulinshufa/yulinshufa.go:312

	}

	wg.Wait()
	return results
}

func (p *YulinshufaPlugin) getDetailResult(item searchItem) (*model.SearchResult, error) {
	cacheKey := item.DetailURL
	if cached, ok := p.loadFromCache(cacheKey); ok {
		p.debugf("详情缓存命中: %s", cacheKey)
		return &cached, nil
	}

	ctx, cancel := context.WithTimeout(context.Background(), detailTimeout)
	defer cancel()

	req, err := http.NewRequestWithContext(ctx, http.MethodGet, item.DetailURL, nil)
	if err != nil {
		return nil, fmt.Errorf("[%s] 创建详情请求失败: %w", p.Name(), err)
	}
	p.decorateCommonHeaders(req)
	req.Header.Set("Referer", baseURL+"/")
	p.debugf("请求详情: %s", item.DetailURL)

	resp, err := p.doRequestWithRetry(p.detailHTTPClient, req, requestMaxRetries)
	if err != nil {
		return nil, fmt.Errorf("[%s] 请求详情失败: %w", p.Name(), err)
	}
	defer resp.Body.Close()

	doc, err := p.buildGBKDocument(resp.Body)
	if err != nil {
		return nil, fmt.Errorf("[%s] 解析详情失败: %w", p.Name(), err)
	}

	result := p.parseDetailDocument(doc, item)
	if result == nil {

View on GitHub (pinned to beaa561337)