{"record":{"id":"8fc1e476bf176cdf","repo":"fish2018/pansou","slug":"web-search-returned-status-d","errorCode":null,"errorMessage":"web search returned status %d","messagePattern":"web search returned status (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/sousou/sousou.go","lineNumber":187,"sourceCode":"}\n\nfunc (p *SousouAsyncPlugin) searchWeb(client *http.Client, keyword string) ([]model.SearchResult, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n\tdefer cancel()\n\n\tsearchURL := SousouWebURL + \"?q=\" + url.QueryEscape(strings.TrimSpace(keyword))\n\treq, err := http.NewRequestWithContext(ctx, http.MethodGet, searchURL, nil)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create web search request failed: %w\", err)\n\t}\n\tsetSousouWebHeaders(req, \"https://www.panso.vip/\")\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"web search request failed: %w\", err)\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"web search returned status %d\", resp.StatusCode)\n\t}\n\n\tdoc, err := goquery.NewDocumentFromReader(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parse web search page failed: %w\", err)\n\t}\n\n\titems := make([]pansoSearchItem, 0, 20)\n\tdoc.Find(\"div.search-item\").Each(func(_ int, item *goquery.Selection) {\n\t\tanchor := item.Find(\"a.search-item-title[href]\").First()\n\t\thref := strings.TrimSpace(anchor.AttrOr(\"href\", \"\"))\n\t\tif href == \"\" {\n\t\t\treturn\n\t\t}\n\t\titems = append(items, pansoSearchItem{\n\t\t\tDocURL:   absolutePansoURL(href),\n\t\t\tTitle:    strings.TrimSpace(anchor.Text()),\n\t\t\tContent:  strings.TrimSpace(item.Find(\".search-item-info\").Text()),","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/sousou/sousou.go#L169-L205","documentation":"searchWeb requires HTTP 200 from the panso.vip web search endpoint. Any other status is converted into 'web search returned status %d' and aborts the web-type search. This is an upstream response-status guard, analogous to error 680 in the Shandian plugin.","triggerScenarios":"resp.StatusCode != http.StatusOK after client.Do in searchWeb — e.g. 403 from anti-bot protection, 429 rate limit, 5xx upstream error, or 301/302 that the client did not follow.","commonSituations":"Cloudflare challenge page (403), IP throttled (429), referer/headers in setSousouWebHeaders no longer accepted, site restructured and endpoint removed (404).","solutions":["Log the status and refresh browser-like headers (User-Agent, Referer, cookies) in setSousouWebHeaders.","Back off and retry on 429/5xx; these are typically transient.","Check whether panso.vip changed its search endpoint path and update SousouWebURL.","Route through a different egress IP/proxy if the IP is blocked by the WAF."],"exampleFix":"// before\nif resp.StatusCode != http.StatusOK {\n    return nil, fmt.Errorf(\"web search returned status %d\", resp.StatusCode)\n}\n// after\nif resp.StatusCode == http.StatusTooManyRequests {\n    return nil, fmt.Errorf(\"web search rate limited (429), retry later\")\n}\nif resp.StatusCode != http.StatusOK {\n    return nil, fmt.Errorf(\"web search returned status %d\", resp.StatusCode)\n}","handlingStrategy":"retry","validationCode":"req.Header.Set(\"User-Agent\", \"Mozilla/5.0 (Windows NT 10.0; Win64; x64)\")\nreq.Header.Set(\"Referer\", \"https://www.panso.vip/\")","typeGuard":null,"tryCatchPattern":"results, err := plugin.Search(keyword)\nif err != nil {\n    var statusErr interface{ Error() string }\n    if strings.Contains(err.Error(), \"web search returned status\") {\n        // backoff on 429/5xx, refresh headers/cookies on 403\n    }\n}","preventionTips":["Keep browser-like headers current in setSousouWebHeaders","Back off and jitter retries on 429 instead of hammering","Rotate egress IPs/proxies if blocked by WAF","Monitor status codes per source to detect blocking early"],"tags":["http","scraping","anti-bot","go"],"backgroundTag":"http-error-response","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"}