fish2018/pansou · error
未找到页面内嵌结果
Error message
未找到页面内嵌结果
What it means
Error returned by parseEmbeddedList when none of the known markers ('const list = JSON.parse(' or 'let listItems = JSON.parse(') appear in the response body, i.e. the page does not contain the expected embedded results blob. Since parseEmbeddedList scans raw bytes, any change to the site's inline JavaScript variable names, or the page being an error/challenge page, triggers this.
Solutions
- Dump the response body on this error and inspect what template the site returned
- Update listMarkers to the new inline-JS pattern if the site renamed its variables
- Migrate to the site's JSON endpoint if results are no longer inlined
- Strengthen request headers/cookies to get past challenge pages
Defensive patterns
Strategy: fallback
Try / catch
if strings.Contains(err.Error(), "未找到页面内嵌结果") {
// page had no embedded list: could be challenge page or empty template
// fallback to alternative source; optionally retry once
} Prevention
- Detect challenge/error pages explicitly before parsing
- Keep marker list in sync with the live site (contract test on a fetched page)
- Fall back to alternate plugins instead of failing the search
- Log a body snippet on failure for fast diagnosis
When it happens
Trigger: GET of /s/<keyword>.html returns HTML without either list marker: search returned a bot-challenge page, an error page, a login wall, or the site changed its inline JS (variable renamed, results moved to a fetched JSON endpoint).
Common situations: Cloudflare/JS challenge page served to non-browser clients; site redesign; results now rendered client-side from an XHR API instead of inline JS; keyword with no results renders a different template.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07).
Data as JSON: /api/errors/c9d2b670d49248e1.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/haitunsou/haitunsou.go:149
func setRequestHeaders(req *http.Request, baseURL string) {
req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36")
req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
req.Header.Set("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8")
req.Header.Set("Cache-Control", "no-cache")
req.Header.Set("Referer", strings.TrimRight(baseURL, "/")+"/")
}
func parseEmbeddedList(body []byte) ([]searchItem, error) {
start := -1
for _, marker := range listMarkers {
if index := indexBytes(body, marker); index >= 0 {
start = index + len(marker)
break
}
}
if start < 0 {
return nil, fmt.Errorf("未找到页面内嵌结果")
}
encoded, err := scanSingleQuotedString(body, start)
if err != nil {
return nil, err
}
decoded, err := decodeJSSingleQuotedString(encoded)
if err != nil {
return nil, err
}
var items []searchItem
if err := jsonutil.Unmarshal(decoded, &items); err != nil {
return nil, fmt.Errorf("解析结果 JSON 失败: %w", err)
}
return items, nil
}
func indexBytes(data, marker []byte) int {View on GitHub (pinned to beaa561337)