fish2018/pansou · error

提取凭证失败

Error message

提取凭证失败

What it means

Extraction failure in PanyqPlugin.getCredentials (plugin/panyq/panyq.go:982): the page body was fetched but none of the sign/sha/hash regexes matched, so the anti-bot credentials cannot be assembled. Usually means the site changed its page structure or served a challenge.

Solutions

  1. 记录页面快照核对正则是否失效
  2. 更新正则以匹配站点新结构
  3. 失败时刷新会话后重试一次
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at plugin/panyq/panyq.go:982 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/5dfbf0aa09e46aeb. Report an issue: GitHub.

Appendix: source

Thrown at plugin/panyq/panyq.go:982

	defer resp.Body.Close()
	
	// 读取响应
	body, err := io.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}
	
	// 使用正则表达式提取凭证
	signRegex := regexp.MustCompile(`"sign":"([^"]+)"`)
	shaRegex := regexp.MustCompile(`"sha":"([a-f0-9]{64})"`)
	hashRegex := regexp.MustCompile(`"hash","([^"]+)"`)
	
	signMatch := signRegex.FindStringSubmatch(string(body))
	shaMatch := shaRegex.FindStringSubmatch(string(body))
	hashMatch := hashRegex.FindStringSubmatch(string(body))
	
	if len(signMatch) < 2 || len(shaMatch) < 2 || len(hashMatch) < 2 {
		return nil, fmt.Errorf("提取凭证失败")
	}
	
	return &Credentials{
		Sign: signMatch[1],
		Sha:  shaMatch[1],
		Hash: hashMatch[1],
	}, nil
}

// getSearchResults 获取搜索结果列表
func (p *PanyqPlugin) getSearchResults(sign string, pageNum int, client *http.Client) ([]SearchHit, int, error) {
	// 构建URL
	searchURL := fmt.Sprintf("%s/api/search?sign=%s&page=%d", BaseURL, sign, pageNum)
	
	// 创建请求
	req, err := http.NewRequest("GET", searchURL, nil)
	if err != nil {
		return nil, 0, err

View on GitHub (pinned to beaa561337)