fish2018/pansou · error

验证脚本参数不完整

Error message

验证脚本参数不完整

What it means

solveVerification extracts the slider-challenge parameters (type, key, value) from the site's verification JavaScript using regexes. If any of the three regex matches is missing its capture group, the plugin cannot build a verification request and throws this error. It signals the anti-bot script changed shape or the wrong JS body was fetched.

Solutions

  1. Fetch the verification JS manually and update verificationTypeRegex/verificationKeyRegex/verificationValueRegex to match the current script format
  2. Log jsBody (or a snippet) on this error to confirm what was actually parsed
  3. Verify the scriptURL resolution in normalizeURL actually points at the challenge script, not an HTML page
  4. Check whether the site now serves a different challenge entirely and implement the new solver

Example fix

// before
typeMatch := verificationTypeRegex.FindStringSubmatch(jsBody)
// after (log payload to debug mismatches)
typeMatch := verificationTypeRegex.FindStringSubmatch(jsBody)
if typeMatch == nil {
    log.Printf("verify js did not match, body head: %.200s", jsBody)
}
Defensive patterns

Strategy: validation

Validate before calling

// Pre-fetch the verify script and confirm parameters exist before relying on the solve
resp, _ := http.Get(scriptURL)
js, _ := io.ReadAll(resp.Body)
ok := verificationTypeRegex.Match(js) && verificationKeyRegex.Match(js) && verificationValueRegex.Match(js)
if !ok { /* site likely changed its challenge; skip or alert */ }

Try / catch

info, err := plugin.GetDetailInfo(ctx, url)
if err != nil && strings.Contains(err.Error(), "验证脚本参数不完整") {
    log.Printf("anti-bot script changed, failing url=%s: %v", url, err)
    return fallbackInfo
}

Prevention

When it happens

Trigger: solveVerification runs verificationTypeRegex/verificationKeyRegex/verificationValueRegex on the fetched JS body and any match returns fewer than 2 elements; called from searchSuggest or getDetailInfo when fetchBody returns a verify page.

Common situations: The target site updated its slider-verification JS so the hardcoded regexes no longer match; a CDN/WAF served a different or minified script; fetchBody returned an HTML error page instead of the JS file (content negotiated differently) while still passing isVerifyPage checks.

Related errors


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

Appendix: source

Thrown at plugin/qiwei/qiwei.go:366

// solveVerification completes the site's deterministic slider challenge. The
// challenge is session-bound, so the caller and this method must share a
// cookie jar on the same http.Client.
func (p *QiweiPlugin) solveVerification(client *http.Client, pageURL, verifyHTML string) error {
	scriptMatch := verificationScriptRegex.FindStringSubmatch(verifyHTML)
	if len(scriptMatch) < 2 {
		return fmt.Errorf("未找到滑动验证脚本")
	}
	scriptURL := normalizeURL(pageURL, scriptMatch[1])
	jsBody, err := p.fetchBody(client, scriptURL, pageURL, detailTimeout)
	if err != nil {
		return fmt.Errorf("获取验证脚本失败: %w", err)
	}

	typeMatch := verificationTypeRegex.FindStringSubmatch(jsBody)
	keyMatch := verificationKeyRegex.FindStringSubmatch(jsBody)
	valueMatch := verificationValueRegex.FindStringSubmatch(jsBody)
	if len(typeMatch) < 2 || len(keyMatch) < 2 || len(valueMatch) < 2 {
		return fmt.Errorf("验证脚本参数不完整")
	}

	encodedValue := md5StringToHex(valueMatch[1])
	endpointPath := "/a20be899_96a6_40b2_88ba_32f1f75f1552_yanzheng_huadong.php"
	if endpointMatch := verificationEndpointRegex.FindStringSubmatch(jsBody); len(endpointMatch) > 1 {
		endpointPath = "/" + endpointMatch[1]
	}
	parsedPage, err := url.Parse(pageURL)
	if err != nil {
		return fmt.Errorf("验证页面地址无效: %w", err)
	}
	verifyURL := (&url.URL{Scheme: parsedPage.Scheme, Host: parsedPage.Host, Path: endpointPath}).String()
	query := url.Values{}
	query.Set("type", typeMatch[1])
	query.Set("key", keyMatch[1])
	query.Set("value", encodedValue)
	verifyURL += "?" + query.Encode()

View on GitHub (pinned to beaa561337)