fish2018/pansou · error

无效的详情页URL格式

Error message

无效的详情页URL格式: %s

What it means

Regex guard in xuexizhinan processDetailPage: detailURL does not match detailURLRegex (no ID captured). Input at fault is the URL handed to the detail fetcher — stale or foreign-format link that escaped the earlier filters. Permanent per-URL failure; caching doesn't apply.

Solutions

  1. Skip the malformed detail URL rather than aborting the batch
  2. Update detailURLRegex if the site changed its URL scheme
  3. Validate URLs at extraction time in the search results
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at plugin/xuexizhinan/xuexizhinan.go:270 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/df00341747a5a64a. Report an issue: GitHub.

Appendix: source

Thrown at plugin/xuexizhinan/xuexizhinan.go:270

	return nil, nil
}

// processDetailPage 处理详情页,提取网盘链接和资源信息
func (p *XuexizhinanPlugin) processDetailPage(client *http.Client, detailURL string) (*model.SearchResult, error) {
	// 检查缓存
	if cachedResult, ok := detailPageCache.Load(detailURL); ok {
		cachedResponse := cachedResult.(detailPageResponse)
		
		// 检查缓存是否过期
		if time.Since(cachedResponse.Timestamp) < cacheTTL {
			return p.detailResponseToResult(detailURL, cachedResponse), nil
		}
	}
	
	// 正则匹配提取ID - 使用预编译的正则表达式
	matches := detailURLRegex.FindStringSubmatch(detailURL)
	if len(matches) < 2 {
		return nil, fmt.Errorf("无效的详情页URL格式: %s", detailURL)
	}
	
	// 发送请求
	req, err := http.NewRequest("GET", detailURL, nil)
	if err != nil {
		return nil, fmt.Errorf("创建请求失败: %w", err)
	}
	
	req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.127 Safari/537.36")
	
	// 添加请求超时控制
	ctx, cancel := context.WithTimeout(req.Context(), DefaultTimeout)
	defer cancel()
	req = req.WithContext(ctx)
	
	// 发送请求
	resp, err := client.Do(req)
	if err != nil {

View on GitHub (pinned to beaa561337)