{"record":{"id":"c4478f49f11353bc","repo":"DIYgod/RSSHub","slug":"invalid-sc","errorCode":null,"errorMessage":"Invalid sc","messagePattern":"Invalid sc","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"warning","filePath":"lib/routes/bt0/tlist.ts","lineNumber":45,"sourceCode":"    },\n    radar: [\n        {\n            source: ['2bt0.com/tlist/'],\n        },\n    ],\n    name: '最新资源列表',\n    maintainers: ['miemieYaho'],\n    handler,\n};\n\nasync function handler(ctx) {\n    const domain = ctx.req.param('domain') ?? '2';\n    const sc = ctx.req.param('sc');\n    if (!/^[1-9]$/.test(domain)) {\n        throw new InvalidParameterError('Invalid domain');\n    }\n    if (!/^[1-5]$/.test(sc)) {\n        throw new InvalidParameterError('Invalid sc');\n    }\n\n    const host = `https://www.${domain}bt0.com`;\n    const _link = `${host}/prod/core/system/getTList?sc=${sc}`;\n\n    const data = await doGot(0, host, _link);\n    const items = data.data.list.map((item) => ({\n        title: item.zname,\n        guid: item.zname,\n        description: `《${item.title}》  导演: ${item.daoyan}<br>编剧: ${item.bianji}<br>演员: ${item.yanyuan}<br>简介: ${item.conta.trim()}`,\n        link: host + item.aurl,\n        pubDate: item.eztime.endsWith('前') ? parseRelativeDate(item.eztime) : item.eztime,\n        enclosure_type: 'application/x-bittorrent',\n        enclosure_url: item.zlink,\n        enclosure_length: genSize(item.zsize),\n        itunes_item_image: item.epic,\n    }));\n    return {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/bt0/tlist.ts#L27-L63","documentation":"InvalidParameterError thrown when the `sc` path param of /bt0/tlist/:domain/:sc does not match /^[1-5]$/. The sc selects a resource-list category on the bt0 mirror, and only categories 1-5 are valid; the guard prevents injecting an out-of-range sc into the getTList query string.","triggerScenarios":"A request where sc is not a single digit in '1'..'5' — e.g. '6', '0', '01', a letter, or undefined.","commonSituations":"Guessing a category number > 5; passing a category name instead of its numeric code; omitting sc.","solutions":["Use a single digit 1-5 for sc, e.g. /bt0/tlist/2/1.","Confirm the desired category's numeric code from the bt0 site's tlist UI."],"exampleFix":"// before\nif (!/^[1-5]$/.test(sc)) {\n    throw new InvalidParameterError('Invalid sc');\n}\n// after\nif (!/^[1-5]$/.test(sc)) {\n    throw new InvalidParameterError(`Invalid sc '${sc}': expected a single digit 1-5`);\n}","handlingStrategy":"validation","validationCode":"if (!/^[1-5]$/.test(sc)) {\n    throw new InvalidParameterError(`Invalid sc '${sc}': expected a single digit 1-5`);\n}","typeGuard":"const isBt0Sc = (s: string): boolean => /^[1-5]$/.test(s);","tryCatchPattern":null,"preventionTips":["Document that sc is a category digit 1-5.","List the meaning of each sc value in the route description."],"tags":["bt0","validation","path-parameter","regex"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}