{"record":{"id":"2bf81f8747745333","repo":"DIYgod/RSSHub","slug":"bad-timerange-range-see-a-href-https-docs-rss","errorCode":null,"errorMessage":"Bad timeRange range. See <a href=\"https://docs.rsshub.app/routes/new-media#wang-yi-xin-wen-pai-hang-bang\">docs</a>","messagePattern":"Bad timeRange range\\. See <a href=\"https://docs\\.rsshub\\.app/routes/new-media#wang-yi-xin-wen-pai-hang-bang\">docs</a>","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"error","filePath":"lib/routes/163/news/rank.ts","lineNumber":127,"sourceCode":"\n新闻分类：\n\n| 全站  | 新闻 | 娱乐          | 体育   | 财经  | 科技 | 汽车 | 女人 | 房产  | 游戏 | 旅游   | 教育 |\n| ----- | ---- | ------------- | ------ | ----- | ---- | ---- | ---- | ----- | ---- | ------ | ---- |\n| whole | news | entertainment | sports | money | tech | auto | lady | house | game | travel | edu  |`,\n};\n\nasync function handler(ctx) {\n    const category = ctx.req.param('category') || 'whole';\n    const type = ctx.req.param('type') || 'click';\n    const time = ctx.req.param('time') || 'day';\n\n    const cfg = config[category];\n    if (!cfg) {\n        throw new InvalidParameterError('Bad category. See <a href=\"https://docs.rsshub.app/routes/new-media#wang-yi-xin-wen-pai-hang-bang\">docs</a>');\n    }\n    if ((category !== 'whole' && type === 'click' && time === 'month') || (category === 'whole' && type === 'click' && time === 'hour') || (type === 'follow' && time === 'hour')) {\n        throw new InvalidParameterError('Bad timeRange range. See <a href=\"https://docs.rsshub.app/routes/new-media#wang-yi-xin-wen-pai-hang-bang\">docs</a>');\n    }\n\n    const currentUrl = category === 'money' ? cfg.link : `${rootUrl}${cfg.link}`;\n    const response = await got({\n        method: 'get',\n        url: currentUrl,\n        responseType: 'buffer',\n    });\n\n    const $ = load(iconv.decode(response.data, 'gbk'));\n\n    const list = $('div.tabContents')\n        .eq(timeRange[time].index + (category === 'whole' ? (type === 'click' ? -1 : 2) : type === 'click' ? 0 : 2))\n        .find('table tbody tr td a')\n        .toArray()\n        .map((item): DataItem => {\n            const $item = $(item);\n","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/163/news/rank.ts#L109-L145","documentation":"Thrown by the 163 (NetEase) news ranking route when the supplied category/type/time triple is a combination 163.com does not publish. The route's description enumerates which time ranges each ranking type supports, and this guard rejects requests the upstream page would render empty rather than silently returning nothing.","triggerScenarios":"Hitting /163/news/rank/<category>/<type>/<time> where: (a) category is not 'whole' but type='click' and time='month'; (b) category='whole' with type='click' and time='hour'; (c) any category with type='follow' and time='hour'.","commonSituations":"Copy-pasting a working URL and swapping only one segment (e.g. changing category from 'whole' to 'news' but keeping time='month'), or assuming the follow (跟贴) ranking supports an hourly breakdown like the click ranking does.","solutions":["For non-whole click rankings use hour/day/week (never month).","For whole click rankings use day/week/month (never hour).","For follow rankings always use day/week/month (never hour).","Consult the route description's tip block for the canonical matrix."],"exampleFix":"// before\n/163/news/rank/news/click/month   // 163 has no monthly click rank for sub-categories\n// after\n/163/news/rank/news/click/week","handlingStrategy":"validation","validationCode":"const VALID = {\n  wholeClick: new Set(['day', 'week', 'month']),     // whole + click\n  subClick:   new Set(['hour', 'day', 'week']),      // non-whole + click\n  follow:     new Set(['day', 'week', 'month']),     // any + follow\n};\nfunction isValid163Rank(category, type, time) {\n  if (type === 'follow') return VALID.follow.has(time);\n  if (category === 'whole') return VALID.wholeClick.has(time);\n  return VALID.subClick.has(time);\n}","typeGuard":"function is163Time(c, t, time): boolean {\n  return (t === 'follow' ? ['day','week','month']\n    : c === 'whole' ? ['day','week','month']\n    : ['hour','day','week']).includes(time);\n}","tryCatchPattern":null,"preventionTips":["Validate the category/type/time triple against the docs matrix before issuing the request.","Treat the route description's tip block as the source of truth, not a single working URL.","When parameterising the URL, change only one segment at a time and re-test."],"tags":["validation","parameter","rsshub","enum","combination"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}