{"record":{"id":"cf300f91a99cb5a3","repo":"fish2018/pansou","slug":"s-post-w","errorCode":null,"errorMessage":"[%s] POST搜索请求失败: %w","messagePattern":"\\[(.+?)\\] POST搜索请求失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/qupanshe/qupanshe.go","lineNumber":91,"sourceCode":"\t// Step 1: 获取首页formhash（使用session客户端）\n\tformhash, err := p.getFormhash(sessionClient)\n\tif err != nil {\n\t\tif DebugLog {\n\t\t\tfmt.Printf(\"[qupanshe] 获取formhash失败: %v\\n\", err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"[%s] 获取formhash失败: %w\", p.Name(), err)\n\t}\n\tif DebugLog {\n\t\tfmt.Printf(\"[qupanshe] 获取到formhash: %s\\n\", formhash)\n\t}\n\n\t// Step 2: POST请求获取搜索结果URL（使用同一个session客户端）\n\tsearchURL, err := p.postSearchRequest(sessionClient, keyword, formhash)\n\tif err != nil {\n\t\tif DebugLog {\n\t\t\tfmt.Printf(\"[qupanshe] POST搜索请求失败: %v\\n\", err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"[%s] POST搜索请求失败: %w\", p.Name(), err)\n\t}\n\tif DebugLog {\n\t\tfmt.Printf(\"[qupanshe] 获取搜索URL成功: %s\\n\", searchURL)\n\t}\n\n\t// Step 3: GET请求获取搜索结果（使用同一个session客户端）\n\tresults, err := p.getSearchResults(sessionClient, searchURL, keyword)\n\tif err != nil {\n\t\tif DebugLog {\n\t\t\tfmt.Printf(\"[qupanshe] 获取搜索结果失败: %v\\n\", err)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"[%s] 获取搜索结果失败: %w\", p.Name(), err)\n\t}\n\tif DebugLog {\n\t\tfmt.Printf(\"[qupanshe] 获取搜索结果成功: 结果数=%d\\n\", len(results))\n\t}\n\n\t// Step 4: 关键词过滤","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/qupanshe/qupanshe.go#L73-L109","documentation":"searchImpl wraps any failure from postSearchRequest, which POSTs the search keyword with the formhash to obtain the search-result URL. Failure means the POST request errored, returned an unexpected status, or the result URL could not be extracted.","triggerScenarios":"p.postSearchRequest(sessionClient, keyword, formhash) fails during Step 2: HTTP request creation/transport error, non-OK response, empty response body, or failure to parse the returned search URL from the response.","commonSituations":"Invalid or expired formhash (session cookies lost), site rate-limiting or WAF blocking the POST, network timeouts, or site form field names changed so the server rejects the request.","solutions":["Confirm Step 1 succeeded and the formhash is fresh — always reuse the same sessionClient so cookies persist","Enable DebugLog to inspect the POST response status and body","Verify POST form field names still match the site's current search form","Add retries with backoff for transient network errors or rate limiting","Check for anti-bot/Cloudflare challenges in the response body"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"POST搜索请求失败\") {\n    // formhash may be stale or request blocked; redo full flow (fresh formhash) once\n    return fullFlowWithRetry(ctx, keyword, 1)\n}","preventionTips":["Run Steps 1-3 quickly in a single session so the formhash stays fresh","Match the site's current POST field names and endpoint","Respect rate limits; add delays between searches","Detect WAF/challenge pages in response bodies"],"tags":["go","scraping","http-post","csrf"],"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"}