{"record":{"id":"423aba9890323912","repo":"fish2018/pansou","slug":"s-s-d-d-423aba","errorCode":null,"errorMessage":"[%s] %s网盘第%d页返回状态码: %d","messagePattern":"\\[(.+?)\\] (.+?)网盘第(.+?)页返回状态码: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/sdso/sdso.go","lineNumber":257,"sourceCode":"\t}\n\n\t// 4. 设置请求头\n\treq.Header.Set(\"User-Agent\", \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36\")\n\treq.Header.Set(\"Accept\", \"application/json, text/plain, */*\")\n\treq.Header.Set(\"Accept-Language\", \"zh-CN,zh;q=0.9,en;q=0.8\")\n\treq.Header.Set(\"Connection\", \"keep-alive\")\n\treq.Header.Set(\"Referer\", \"https://sdso.top/\")\n\n\t// 5. 发送HTTP请求（带重试机制）\n\tresp, err := p.doRequestWithRetry(req, client)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] %s网盘第%d页请求失败: %w\", p.Name(), fromType, pageNo, err)\n\t}\n\tdefer resp.Body.Close()\n\n\t// 6. 检查状态码\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"[%s] %s网盘第%d页返回状态码: %d\", p.Name(), fromType, pageNo, resp.StatusCode)\n\t}\n\n\t// 7. 解析响应\n\tvar apiResp APIResponse\n\tif err := json.NewDecoder(resp.Body).Decode(&apiResp); err != nil {\n\t\treturn nil, fmt.Errorf(\"[%s] %s网盘第%d页JSON解析失败: %w\", p.Name(), fromType, pageNo, err)\n\t}\n\n\t// 8. 检查API响应状态\n\tif apiResp.Code != 200 {\n\t\treturn nil, fmt.Errorf(\"[%s] %s网盘第%d页API错误: %s\", p.Name(), fromType, pageNo, apiResp.Msg)\n\t}\n\n\tif DebugLog {\n\t\tfmt.Printf(\"[%s] %s网盘第%d页获取到 %d 个原始结果\\n\", p.Name(), fromType, pageNo, len(apiResp.Data.List))\n\t}\n\n\t// 9. 转换为标准格式","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/sdso/sdso.go#L239-L275","documentation":"After a successful HTTP exchange, fetchSinglePageWithType checks the response status code and fails when it is anything other than 200. The message includes the actual status code, so the number in the error identifies the server's reaction (403 blocked, 429 rate-limited, 5xx server error, etc.).","triggerScenarios":"sdso.top's /api/sd/search endpoint returns a non-200 HTTP status for a page request, e.g. 403 (anti-bot/Cloudflare challenge), 429 (too many requests), 404 (endpoint moved), 500/502/503 (server-side problems).","commonSituations":"Scraping too aggressively triggers rate limiting (429); the site sits behind Cloudflare which serves a 403/503 challenge page to non-browser clients; the API path changed after a site update (404); transient upstream 5xx.","solutions":["Read the status code from the error message: 403/503 → likely anti-bot; 429 → back off; 404 → endpoint changed.","For 429, reduce request rate / pages per type and retry later.","For 403 with Cloudflare, the plugin's headers may need updating or the source is unusable from that IP.","For 404, check whether sdso.top changed its API and update the searchURL in the plugin.","Rely on other search plugins in the aggregator since one source failing is non-fatal."],"exampleFix":"// before\nfor pageNo := 1; pageNo <= 10; pageNo++ { go fetch(pageNo) } // hammers the API\n// after\nsem := make(chan struct{}, 2) // limit concurrency\nfor pageNo := 1; pageNo <= 10; pageNo++ {\n    sem <- struct{}{}\n    go func(n int) { defer func() { <-sem }(); fetch(n) }(pageNo)\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"results, err := plugin.Search(ctx, keyword)\nif err != nil {\n    var se struct{ Code int }\n    if n, _ := fmt.Sscanf(err.Error(), \"...返回状态码: %d\", &se.Code); n == 1 && se.Code == 429 {\n        time.Sleep(30 * time.Second) // rate-limited; back off\n    }\n}","preventionTips":["Limit concurrency and add jittered delays between page requests","Rotate User-Agent/IP if the site applies anti-bot measures","Alert on persistent 4xx/5xx from the source","Depend on multiple search plugins so one blocked source is non-fatal"],"tags":["http","status-code","scraping","rate-limit","go"],"backgroundTag":"http-non-200-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"}