fish2018/pansou · error
重新登录后搜索仍然失败
Error message
重新登录后搜索仍然失败: %w
What it means
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.
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.
Defensive patterns
Strategy: retry
Try / catch
results, err := p.Search(keyword)
if err != nil && strings.Contains(err.Error(), "重新登录后搜索仍然失败") {
select {
case <-time.After(longerBackoff):
results, err = p.Search(keyword)
case <-ctx.Done():
return ctx.Err()
}
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07).
Data as JSON: /api/errors/52fdc64954f17f97.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/gying/gying.go:2419
// 获取新的scraper实例
scraperVal, exists := p.scrapers.Load(user.Hash)
if !exists {
return nil, fmt.Errorf("重新登录后未找到scraper实例")
}
newScraper, ok := scraperVal.(*cloudscraper.Scraper)
if !ok || newScraper == nil {
return nil, fmt.Errorf("重新登录后scraper实例无效")
}
// 使用新scraper重试搜索
if DebugLog {
fmt.Printf("[Gying] 🔄 使用新登录状态重试搜索\n")
}
results, err = p.searchWithScraper(keyword, newScraper)
if err != nil {
return nil, fmt.Errorf("重新登录后搜索仍然失败: %w", err)
}
if syncErr := p.syncUserCookiesFromScraper(user, newScraper); syncErr != nil && DebugLog {
fmt.Printf("[Gying] ⚠️ 重登搜索后同步用户 %s Cookie失败: %v\n", user.Username, syncErr)
}
}
return results, err
}
// searchWithScraper 使用scraper搜索
func (p *GyingPlugin) searchWithScraper(keyword string, scraper *cloudscraper.Scraper) ([]model.SearchResult, error) {
if DebugLog {
fmt.Printf("[Gying] ---------- searchWithScraper 开始 ----------\n")
fmt.Printf("[Gying] 关键词: %s\n", keyword)
}
// 1. 使用cloudscraper请求搜索页面
// searchURL := fmt.Sprintf("%s/s/1---1/%s", p.getBaseURL(), url.QueryEscape(keyword))View on GitHub (pinned to beaa561337)