{"record":{"id":"52fdc64954f17f97","repo":"fish2018/pansou","slug":"w-52fdc6","errorCode":null,"errorMessage":"重新登录后搜索仍然失败: %w","messagePattern":"重新登录后搜索仍然失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/gying/gying.go","lineNumber":2419,"sourceCode":"\n\t\t// 获取新的scraper实例\n\t\tscraperVal, exists := p.scrapers.Load(user.Hash)\n\t\tif !exists {\n\t\t\treturn nil, fmt.Errorf(\"重新登录后未找到scraper实例\")\n\t\t}\n\n\t\tnewScraper, ok := scraperVal.(*cloudscraper.Scraper)\n\t\tif !ok || newScraper == nil {\n\t\t\treturn nil, fmt.Errorf(\"重新登录后scraper实例无效\")\n\t\t}\n\n\t\t// 使用新scraper重试搜索\n\t\tif DebugLog {\n\t\t\tfmt.Printf(\"[Gying] 🔄 使用新登录状态重试搜索\\n\")\n\t\t}\n\t\tresults, err = p.searchWithScraper(keyword, newScraper)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"重新登录后搜索仍然失败: %w\", err)\n\t\t}\n\t\tif syncErr := p.syncUserCookiesFromScraper(user, newScraper); syncErr != nil && DebugLog {\n\t\t\tfmt.Printf(\"[Gying] ⚠️  重登搜索后同步用户 %s Cookie失败: %v\\n\", user.Username, syncErr)\n\t\t}\n\t}\n\n\treturn results, err\n}\n\n// searchWithScraper 使用scraper搜索\nfunc (p *GyingPlugin) searchWithScraper(keyword string, scraper *cloudscraper.Scraper) ([]model.SearchResult, error) {\n\tif DebugLog {\n\t\tfmt.Printf(\"[Gying] ---------- searchWithScraper 开始 ----------\\n\")\n\t\tfmt.Printf(\"[Gying] 关键词: %s\\n\", keyword)\n\t}\n\n\t// 1. 使用cloudscraper请求搜索页面\n\t// searchURL := fmt.Sprintf(\"%s/s/1---1/%s\", p.getBaseURL(), url.QueryEscape(keyword))","sourceCodeStart":2401,"sourceCodeEnd":2437,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/gying/gying.go#L2401-L2437","documentation":"Wraps the failure of the retried search: after a 403 and a successful re-login, the search was re-executed with the fresh scraper via searchWithScraper and still returned an error. This means new credentials did not resolve the original search failure.","triggerScenarios":"403-triggered recovery path: reloginUser succeeds, newScraper is fetched, p.searchWithScraper(keyword, newScraper) returns an error (site returns an error status, Cloudflare still challenging, or page structure changed).","commonSituations":"Site-wide outage or maintenance; keyword triggers server-side error; new session immediately blocked/rate-limited; site HTML changed so the scraper request itself is rejected.","solutions":["Inspect the wrapped %w error from searchWithScraper for the actual HTTP/page failure.","Wait and retry — often a temporary site-side problem or rate limit.","Check manually in a browser whether the site search works with a valid session.","Update the plugin if the site's response format or anti-bot layer changed."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"results, err := p.Search(keyword)\nif err != nil && strings.Contains(err.Error(), \"重新登录后搜索仍然失败\") {\n    select {\n    case <-time.After(longerBackoff):\n        results, err = p.Search(keyword)\n    case <-ctx.Done():\n        return ctx.Err()\n    }\n}","preventionTips":["Add exponential backoff for post-relogin search retries.","Check site status out-of-band before hammering retries.","Rotate accounts/proxies if new sessions are immediately blocked."],"tags":["http-403","retry-failed","search"],"backgroundTag":"api-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"}