{"record":{"id":"6a5f72d2170542b1","repo":"fish2018/pansou","slug":"post-w","errorCode":null,"errorMessage":"登录POST请求失败: %w","messagePattern":"登录POST请求失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/gying/gying.go","lineNumber":2153,"sourceCode":"\t// ========== 步骤2: POST登录 (获取认证cookies) ==========\n\tloginURL := p.getLoginAPIURL()\n\tpostData := fmt.Sprintf(\"code=&siteid=1&dosubmit=1&cookietime=10506240&username=%s&password=%s\",\n\t\turl.QueryEscape(username),\n\t\turl.QueryEscape(password))\n\n\tif DebugLog {\n\t\tfmt.Printf(\"[Gying] 步骤2: POST登录\\n\")\n\t\tfmt.Printf(\"[Gying] 登录URL: %s\\n\", loginURL)\n\t\tfmt.Printf(\"[Gying] POST数据: code=&siteid=1&dosubmit=1&cookietime=10506240&username=%s&password=<len:%d>\\n\",\n\t\t\turl.QueryEscape(username), len(password))\n\t}\n\n\tbody, statusCode, headers, err := p.requestWithChallengeRetry(scraper, http.MethodPost, loginURL, \"application/x-www-form-urlencoded\", postData)\n\tif err != nil {\n\t\tif DebugLog {\n\t\t\tfmt.Printf(\"[Gying] 登录POST请求失败: %v\\n\", err)\n\t\t}\n\t\treturn nil, \"\", fmt.Errorf(\"登录POST请求失败: %w\", err)\n\t}\n\t// 从POST登录响应中收集cookies\n\tcollectSetCookies(headers, cookieMap)\n\tlogSetCookiesForDebug(headers, \"[Gying]   POST登录Cookie: %s=%s\\n\", 20)\n\n\tif DebugLog {\n\t\tfmt.Printf(\"[Gying] 响应状态码: %d\\n\", statusCode)\n\t}\n\n\t// 读取响应\n\tif DebugLog {\n\t\tfmt.Printf(\"[Gying] 响应内容: %s\\n\", string(body))\n\t}\n\n\tvar loginResp map[string]interface{}\n\tif err := json.Unmarshal(body, &loginResp); err != nil {\n\t\tif DebugLog {\n\t\t\tfmt.Printf(\"[Gying] JSON解析失败: %v\\n\", err)","sourceCodeStart":2135,"sourceCodeEnd":2171,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/gying/gying.go#L2135-L2171","documentation":"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.","triggerScenarios":"Login step 2: requestWithChallengeRetry(POST, loginURL, ...) returns a non-nil error — connection reset, timeout, TLS failure, or unsolved challenge retries during the POST.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"res, err := gyingLogin(ctx, creds)\nif err != nil && strings.Contains(err.Error(), \"登录POST请求失败\") {\n    // transport-level POST failure: safe to retry with backoff\n    time.Sleep(2 * time.Second)\n    return gyingLogin(ctx, creds)\n}","preventionTips":["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."],"tags":["network","http","post","login"],"backgroundTag":"http-request-failed","analyzedSha":"beaa56133755a548ebc51b090b3816e2ae044aa6","analyzedAt":"2026-09-07T00:31:18.025Z","contentChangedAt":"2026-09-07T00:31:18.025Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}