fish2018/pansou · error
登录POST请求失败
Error message
登录POST请求失败: %w
What it means
Step 2 of gying login POSTs the credentials form (application/x-www-form-urlencoded) to the login endpoint via requestWithChallengeRetry. If the POST itself fails at the transport level, the error is wrapped as '登录POST请求失败: %w' and login aborts before the response can be parsed.
Solutions
- Retry the login — transient network/timeout failures often clear on a second attempt.
- Verify the site and proxy are reachable (step 1 succeeded, so check whether the proxy throttles POSTs).
- Clear cookies and restart login so the POST carries fresh challenge cookies.
- Enable DebugLog for the wrapped cause and retry count to distinguish network vs. challenge failures.
- Reduce request rate; aggressive retries can get the IP challenged on every request.
Defensive patterns
Strategy: retry
Try / catch
res, err := gyingLogin(ctx, creds)
if err != nil && strings.Contains(err.Error(), "登录POST请求失败") {
// transport-level POST failure: safe to retry with backoff
time.Sleep(2 * time.Second)
return gyingLogin(ctx, creds)
} Prevention
- Retry transient POST failures with exponential backoff.
- Keep cookies fresh so the POST doesn't trigger a new challenge.
- Avoid submitting large/rate-limited requests through flaky proxies.
- Enable DebugLog to distinguish network vs. challenge causes.
When it happens
Trigger: Login step 2: requestWithChallengeRetry(POST, loginURL, ...) returns a non-nil error — connection reset, timeout, TLS failure, or unsolved challenge retries during the POST.
Common situations: Site rejects/filters POSTs from flagged IPs; proxy drops the larger POST body; transient network blip; Cloudflare challenge appearing mid-flow because cookies collected in step 1 are stale.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07).
Data as JSON: /api/errors/6a5f72d2170542b1.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/gying/gying.go:2153
// ========== 步骤2: POST登录 (获取认证cookies) ==========
loginURL := p.getLoginAPIURL()
postData := fmt.Sprintf("code=&siteid=1&dosubmit=1&cookietime=10506240&username=%s&password=%s",
url.QueryEscape(username),
url.QueryEscape(password))
if DebugLog {
fmt.Printf("[Gying] 步骤2: POST登录\n")
fmt.Printf("[Gying] 登录URL: %s\n", loginURL)
fmt.Printf("[Gying] POST数据: code=&siteid=1&dosubmit=1&cookietime=10506240&username=%s&password=<len:%d>\n",
url.QueryEscape(username), len(password))
}
body, statusCode, headers, err := p.requestWithChallengeRetry(scraper, http.MethodPost, loginURL, "application/x-www-form-urlencoded", postData)
if err != nil {
if DebugLog {
fmt.Printf("[Gying] 登录POST请求失败: %v\n", err)
}
return nil, "", fmt.Errorf("登录POST请求失败: %w", err)
}
// 从POST登录响应中收集cookies
collectSetCookies(headers, cookieMap)
logSetCookiesForDebug(headers, "[Gying] POST登录Cookie: %s=%s\n", 20)
if DebugLog {
fmt.Printf("[Gying] 响应状态码: %d\n", statusCode)
}
// 读取响应
if DebugLog {
fmt.Printf("[Gying] 响应内容: %s\n", string(body))
}
var loginResp map[string]interface{}
if err := json.Unmarshal(body, &loginResp); err != nil {
if DebugLog {
fmt.Printf("[Gying] JSON解析失败: %v\n", err)View on GitHub (pinned to beaa561337)