{"record":{"id":"fb9aa206717d573f","repo":"fish2018/pansou","slug":"s-s-d-api-s-fb9aa2","errorCode":null,"errorMessage":"[%s] %s网盘第%d页API错误: %s","messagePattern":"\\[(.+?)\\] (.+?)网盘第(.+?)页API错误: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/sdso/sdso.go","lineNumber":268,"sourceCode":"\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. 转换为标准格式\n\tresults := make([]model.SearchResult, 0, len(apiResp.Data.List))\n\tprocessedCount := 0\n\tskippedCount := 0\n\t\n\tfor i, item := range apiResp.Data.List {\n\t\t// 解密网盘链接\n\t\tdecryptedURL, err := DecryptURL(item.URL)\n\t\tif err != nil {\n\t\t\tif DebugLog {\n\t\t\t\tfmt.Printf(\"[%s] %s网盘第%d页第%d项解密失败: %v\\n\", p.Name(), fromType, pageNo, i+1, err)\n\t\t\t}","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/sdso/sdso.go#L250-L286","documentation":"The HTTP response was valid JSON, but the API's business-logic status field (APIResponse.Code) is not 200. The API itself reported an application-level error, whose human-readable message is included in the error (APIResponse.Msg).","triggerScenarios":"sdso.top /api/sd/search responds with JSON where code != 200 — e.g. invalid parameters, search keyword rejected, rate limiting enforced at the application layer, account/quota errors, or an upstream failure reported inside the JSON envelope.","commonSituations":"Application-level rate limiting after heavy scraping; the API requiring new mandatory parameters after a site update; keyword rejected by server-side validation; the site's backend database/service being down while the gateway still returns JSON errors.","solutions":["Read the Msg embedded in the error — it usually states the server-side reason directly.","For rate-limit-style messages, reduce request frequency and add backoff between page requests.","For parameter errors, verify keyword/fromType/pageNo against the current API contract and update the plugin.","Treat persistent code!=200 responses as a site-contract change: re-check the sdso.top frontend for API updates.","Fall back to other search plugins in the aggregator for this keyword."],"exampleFix":"// before\nif apiResp.Code != 200 {\n    return nil, fmt.Errorf(\"API错误: %s\", apiResp.Msg)\n}\n// after\nif apiResp.Code == 429 {\n    time.Sleep(2 * time.Second)\n    return p.fetchSinglePageWithType(client, keyword, pageNo, fromType) // retry once\n}\nif apiResp.Code != 200 {\n    return nil, fmt.Errorf(\"API错误: %s\", apiResp.Msg)\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"results, err := plugin.Search(ctx, keyword)\nif err != nil && strings.Contains(err.Error(), \"API错误\") {\n    // server-reported business error; log Msg and degrade gracefully\n    log.Printf(\"sdso API rejected the search: %v\", err)\n}","preventionTips":["Read the Msg field embedded in the error for the server's reason","Back off on rate-limit style messages","Re-verify API parameters after site updates","Fall back to other plugins for the keyword"],"tags":["api","scraping","error-response","go"],"backgroundTag":"api-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"}