DIYgod/RSSHub · warning · InvalidParameterError
Invalid number
Error message
Invalid number
What it means
InvalidParameterError thrown when the `number` path param of /bt0/mv/:domain/:number does not match /^\d{6,}$/ (six or more digits). The number is interpolated directly into the getVideoDetail API path, so this guard prevents malformed/abusive path injection.
Source
Thrown at lib/routes/bt0/mv.ts:37
radar: [
{
source: ['2bt0.com/mv/'],
},
],
name: '影视资源下载列表',
maintainers: ['miemieYaho'],
handler,
};
async function handler(ctx) {
const domain = ctx.req.param('domain') ?? '2';
const number = ctx.req.param('number');
if (!/^[1-9]$/.test(domain)) {
throw new InvalidParameterError('Invalid domain');
}
const regex = /^\d{6,}$/;
if (!regex.test(number)) {
throw new InvalidParameterError('Invalid number');
}
const host = `https://www.${domain}bt0.com`;
const _link = `${host}/prod/core/system/getVideoDetail/${number}`;
const data = (await doGot(0, host, _link)).data;
const items = Object.values<any[]>(data.ecca).flatMap((item) =>
item.map((i) => ({
title: i.zname,
guid: i.zname,
description: `${i.zname}[${i.zsize}]`,
link: `${host}/tr/${i.id}.html`,
pubDate: i.ezt,
enclosure_type: 'application/x-bittorrent',
enclosure_url: i.zlink,
enclosure_length: genSize(i.zsize),
category: strsJoin(i.zqxd, i.text_html, i.audio_html, i.new === 1 ? '新' : ''),
}))View on GitHub (pinned to bed535e087)
Solutions
- Provide a numeric id of at least 6 digits, copied from the bt0 site's video detail URL.
- Confirm the route path includes both :domain and :number segments.
Example fix
// before
if (!regex.test(number)) {
throw new InvalidParameterError('Invalid number');
}
// after
if (!regex.test(number)) {
throw new InvalidParameterError(`Invalid number '${number}': expected 6+ digits`);
} Defensive patterns
Strategy: validation
Validate before calling
const NUMBER_RE = /^\d{6,}$/;
if (!NUMBER_RE.test(number)) {
throw new InvalidParameterError(`Invalid number '${number}': expected 6+ digits`);
} Type guard
const isBt0Number = (n: string): boolean => /^\d{6,}$/.test(n); Prevention
- Document that number is the 6+ digit video id from the bt0 detail URL.
- Reject early to avoid injecting malformed values into the API path.
When it happens
Trigger: A request where the number param contains non-digits, is shorter than 6 characters, or is missing entirely (undefined fails the regex test).
Common situations: Omitting the number param; passing a video title or alphanumeric id; passing a 4-5 digit id.
Related errors
- Invalid domain
- Invalid domain
- Invalid sc
- Invalid Engine Value: ${engine}, please check your config.
- ${type} is not supported
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/5cbbfce2f751e8c7.
Report an issue: GitHub.