fish2018/pansou · error
未找到搜索结果数据
Error message
未找到搜索结果数据
What it means
The search response body did not match searchDataPattern — the regex that extracts the embedded _obj.search JSON — and the body was not a login shell. The plugin could not locate any search result data in the page, so it cannot return results.
Solutions
- Try a different keyword to rule out a special no-results page layout.
- Update the plugin's searchDataPattern regex to match the site's current page structure.
- Enable DebugLog to inspect the response body (it prints whether '_obj.search' appears at all).
- Check whether the site serves a challenge page; if so fix the Cloudflare/session handling first.
Example fix
// before
var searchDataPattern = regexp.MustCompile(`_obj\.search\s*=\s*(\{.*?\});`)
// after — match updated site markup
var searchDataPattern = regexp.MustCompile(`_obj\.search\s*=\s*(\{.+?\})\s*;?\s*` + "`" + `s`) Defensive patterns
Strategy: fallback
Try / catch
results, err := p.Search(keyword)
if err != nil && strings.Contains(err.Error(), "未找到搜索结果数据") {
// fall back: verify with a simple keyword that the site layout is unchanged
if probe, perr := p.Search("test"); perr != nil {
return fmt.Errorf("site layout may have changed: %w", perr)
}
return err
} Prevention
- Enable DebugLog to capture response bodies when parsing breaks.
- Track site frontend updates that move/rename the _obj.search blob.
- Test searches with common keywords after plugin/site upgrades.
When it happens
Trigger: searchWithScraper parses a 200, non-login HTML page whose content lacks a matchable _obj.search JSON: empty result page rendered differently, site markup/JS changed, or an interstitial/error page served.
Common situations: Site frontend update changed the embedded JSON variable or its escaping; search keyword yields a special 'no results' page with different structure; anti-bot served a challenge page that isn't the standard login shell.
Related errors
AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07).
Data as JSON: /api/errors/63a7f588d44dabef.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/gying/gying.go:2506
fmt.Printf("[Gying] 正则匹配结果: 找到 %d 个匹配\n", len(matches))
}
if isLoginShell(body) {
return nil, fmt.Errorf("HTTP 403 Forbidden - 需要重新登录")
}
if len(matches) < 2 {
if DebugLog {
fmt.Printf("[Gying] ❌ 未找到 _obj.search JSON数据\n")
// 尝试查找是否有其他模式
if strings.Contains(string(body), "_obj.search") {
fmt.Printf("[Gying] 但是Body中包含 '_obj.search' 字符串\n")
} else {
fmt.Printf("[Gying] Body中不包含 '_obj.search' 字符串\n")
}
}
return nil, fmt.Errorf("未找到搜索结果数据")
}
if DebugLog {
jsonStr := string(matches[1])
if len(jsonStr) > 200 {
jsonStr = jsonStr[:200] + "..."
}
fmt.Printf("[Gying] 提取的JSON数据: %s\n", jsonStr)
}
var searchData SearchData
if err := json.Unmarshal(matches[1], &searchData); err != nil {
if DebugLog {
fmt.Printf("[Gying] JSON解析失败: %v\n", err)
fmt.Printf("[Gying] 原始JSON: %s\n", string(matches[1]))
}
return nil, fmt.Errorf("解析搜索数据失败: %w", err)
}View on GitHub (pinned to beaa561337)