{"record":{"id":"c9d2b670d49248e1","repo":"fish2018/pansou","slug":"error-c9d2b6","errorCode":null,"errorMessage":"未找到页面内嵌结果","messagePattern":"未找到页面内嵌结果","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/haitunsou/haitunsou.go","lineNumber":149,"sourceCode":"\nfunc setRequestHeaders(req *http.Request, baseURL string) {\n\treq.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\")\n\treq.Header.Set(\"Accept\", \"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\")\n\treq.Header.Set(\"Accept-Language\", \"zh-CN,zh;q=0.9,en;q=0.8\")\n\treq.Header.Set(\"Cache-Control\", \"no-cache\")\n\treq.Header.Set(\"Referer\", strings.TrimRight(baseURL, \"/\")+\"/\")\n}\n\nfunc parseEmbeddedList(body []byte) ([]searchItem, error) {\n\tstart := -1\n\tfor _, marker := range listMarkers {\n\t\tif index := indexBytes(body, marker); index >= 0 {\n\t\t\tstart = index + len(marker)\n\t\t\tbreak\n\t\t}\n\t}\n\tif start < 0 {\n\t\treturn nil, fmt.Errorf(\"未找到页面内嵌结果\")\n\t}\n\n\tencoded, err := scanSingleQuotedString(body, start)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdecoded, err := decodeJSSingleQuotedString(encoded)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar items []searchItem\n\tif err := jsonutil.Unmarshal(decoded, &items); err != nil {\n\t\treturn nil, fmt.Errorf(\"解析结果 JSON 失败: %w\", err)\n\t}\n\treturn items, nil\n}\n\nfunc indexBytes(data, marker []byte) int {","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/haitunsou/haitunsou.go#L131-L167","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"未找到页面内嵌结果\") {\n    // page had no embedded list: could be challenge page or empty template\n    // fallback to alternative source; optionally retry once\n}","preventionTips":["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"],"tags":["scraping","html-parsing","marker-missing"],"backgroundTag":"resource-not-found","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"}