fish2018/pansou · error

未找到uin

Error message

未找到uin

What it means

extractLoginInfo (plugin/qqpd/qqpd.go:1865) found the callback URL and ptsigx but the regex `uin=(\d+)` found no numeric uin query parameter in the URL, returning '未找到uin'. Without the uin (the logged-in QQ number) the plugin cannot associate the new cookie with a stored user.

Solutions

  1. Log the full extracted URL to see what parameter carries the account id
  2. If the uin may be percent-encoded, URL-decode the URL before matching or widen the regex to `uin=([^&']+)`
  3. Reject non-numeric/unsupported account types with a clear user-facing message
  4. Verify the ptqrlogin appid/target matches plain QQ login (not another account system)

Example fix

// before
uinRe := regexp.MustCompile(`uin=(\d+)`)
// after
decoded, _ := url.QueryUnescape(url)
uinRe := regexp.MustCompile(`uin=(\d+)`)
uinMatches := uinRe.FindStringSubmatch(decoded)
Defensive patterns

Strategy: validation

Validate before calling

// confirm the callback URL carries a numeric uin before extraction
u, err := url.Parse(extractedURL)
if err != nil || u.Query().Get("uin") == "" {
    return errors.New("login url missing uin")
}
if _, err := strconv.ParseUint(u.Query().Get("uin"), 10, 64); err != nil {
    return fmt.Errorf("uin not numeric: %q", u.Query().Get("uin"))
}

Type guard

func hasNumericUin(loginURL string) bool {
    u, err := url.Parse(loginURL)
    if err != nil { return false }
    _, err = strconv.ParseUint(u.Query().Get("uin"), 10, 64)
    return err == nil
}

Try / catch

ptsigx, uin, err := p.extractLoginInfo(bodyStr)
if err != nil {
    if err.Error() == "未找到uin" {
        return nil, errors.New("login response had no QQ number; unsupported account type or format change")
    }
    return nil, err
}

Prevention

When it happens

Trigger: checkQRLoginStatus -> extractLoginInfo: the ptuiCB URL lacks `uin=<digits>` — e.g. the login target is not a standard QQ-number account or the URL shape changed.

Common situations: Logging in with an account type whose uin is non-numeric or omitted (some merged/wx-linked accounts), QQ changing the parameter, or a URL-encoded value breaking the `\d+` pattern.

Related errors


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

Appendix: source

Thrown at plugin/qqpd/qqpd.go:1865

	if len(matches) < 2 {
		return "", "", fmt.Errorf("无法解析响应")
	}

	url := matches[1]

	// 提取ptsigx
	ptsigxRe := regexp.MustCompile(`ptsigx=([A-Za-z0-9]+)`)
	ptsigxMatches := ptsigxRe.FindStringSubmatch(url)
	if len(ptsigxMatches) < 2 {
		return "", "", fmt.Errorf("未找到ptsigx")
	}
	ptsigx := ptsigxMatches[1]

	// 提取uin
	uinRe := regexp.MustCompile(`uin=(\d+)`)
	uinMatches := uinRe.FindStringSubmatch(url)
	if len(uinMatches) < 2 {
		return "", "", fmt.Errorf("未找到uin")
	}
	uin := uinMatches[1]

	return ptsigx, uin, nil
}

// fetchFullCookie 获取完整Cookie
func (p *QQPDPlugin) fetchFullCookie(uin, ptsigx, setCookieHeader string) (string, error) {
	checkSigURL := fmt.Sprintf("https://ptlogin2.pd.qq.com/check_sig?pttype=1&uin=%s&service=ptqrlogin&nodirect=1&ptsigx=%s&s_url=https%%3A%%2F%%2Fpd.qq.com%%2Fexplore&f_url=&ptlang=2052&ptredirect=101&aid=1600001587&daid=823&j_later=0&low_login_hour=0&regmaster=0&pt_login_type=3&pt_aid=0&pt_aaid=16&pt_light=0&pt_3rd_aid=0", uin, ptsigx)

	client := &http.Client{
		Timeout: 10 * time.Second,
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		},
	}

	req, err := http.NewRequest("GET", checkSigURL, nil)

View on GitHub (pinned to beaa561337)