DIYgod/RSSHub · error · InvalidParameterError
不支持当前Discuz版本.
Error message
不支持当前Discuz版本.
What it means
Thrown by the Discuz generic forum route when the detected Discuz version string does not match either 'DISCUZ! 7' (7.x series) or 'DISCUZ! X' (X series). The version is obtained from the route's optional `ver` path parameter (e.g. `/discuz/x/`) or, if absent, from the page's `<meta name="generator">` tag. The route only supports these two families; any other version string (e.g. Discuz! 6.x, Discuz! 3.x without 'X' prefix, or a modified forum that strips the generator tag in a non-standard way) hits this else-branch.
Source
Thrown at lib/routes/discuz/discuz.ts:184
title: a.text(),
link: fixUrl(a.attr('href'), link),
pubDate: $item.find('td.by:nth-child(3) em span').last().length ? parseDate($item.find('td.by:nth-child(3) em span').last().text().trim()) : undefined,
author: $item.find('td.by:nth-child(3) cite a').text().trim(),
};
});
items = await Promise.all(
list.map((item) =>
cache.tryGet(item.link!, async () => {
const { description } = await loadContent(item.link, charset, header);
item.description = description;
return item;
})
)
);
} else {
throw new InvalidParameterError('不支持当前Discuz版本.');
}
return {
title: $('head > title').text(),
description: $('head > meta[name=description]').attr('content'),
link,
item: items,
};
}
View on GitHub (pinned to bed535e087)
Solutions
- Visit the forum URL in a browser, inspect the page source for <meta name="generator">, and confirm whether it reads 'DISCUZ! X*' or 'DISCUZ! 7*'.
- If the meta tag is missing or non-standard, supply the version explicitly in the route path: use /discuz/x/<url-encoded-link> for X series or /discuz/7/<url-encoded-link> for 7.x series.
- If the forum is behind an anti-bot wall, wait and retry, or try from a different IP. The route already retries with cookies but may still fail on JS challenges.
- If the forum runs a genuinely unsupported Discuz version, open an issue or PR to add support for that version's HTML structure.
Example fix
// before
const version = ver ? `DISCUZ! ${ver}` : $('head > meta[name=generator]').attr('content');
if (version.toUpperCase().startsWith('DISCUZ! 7')) { ... }
else if (version.toUpperCase().startsWith('DISCUZ! X')) { ... }
else { throw new InvalidParameterError('不支持当前Discuz版本.'); }
// after — case-insensitive 'X' anywhere in version string, or use detected version as fallback
if (version?.toUpperCase().includes('DISCUZ! 7') || ver === '7') { ... }
else if (version?.toUpperCase().includes('DISCUZ! X') || /^(x)$/i.test(ver)) { ... }
else { throw new InvalidParameterError(`不支持当前Discuz版本: ${version ?? 'unknown'}. Supported: 7.x, X series.`); } Defensive patterns
Strategy: validation
Validate before calling
// Before calling the route, verify the forum's Discuz version
// Check the generator meta tag
const resp = await fetch(forumUrl);
const html = await resp.text();
const match = html.match(/<meta\s+name=["']generator["']\s+content=["']([^"']+)["']/i);
const version = match?.[1];
const isSupported = version?.toUpperCase().startsWith('DISCUZ! 7') || version?.toUpperCase().startsWith('DISCUZ! X');
if (!isSupported) {
console.warn(`Forum version ${version} may not be supported. Use /discuz/x/ or /discuz/7/ prefix.`);
} Try / catch
// Wrap the route call and catch InvalidParameterError specifically
try {
const feed = await fetch(`${rsshubUrl}/discuz/${ver}/${encodeURIComponent(forumUrl)}`);
} catch (e) {
if (e.message.includes('不支持当前Discuz版本')) {
// Try the other version prefix
const altVer = ver === 'x' ? '7' : 'x';
return fetch(`${rsshubUrl}/discuz/${altVer}/${encodeURIComponent(forumUrl)}`);
}
throw e;
} Prevention
- Always specify the version prefix in the route path (/discuz/x/ or /discuz/7/) rather than relying on auto-detection.
- Before subscribing, verify the forum's generator meta tag in a browser.
- If the forum uses anti-bot measures, test with the explicit version prefix first.
When it happens
Trigger: Supplying a forum URL whose generator meta tag reads something other than 'DISCUZ! 7*' or 'DISCUZ! X*'; supplying an explicit `ver` param that does not start with '7' or 'X' (the regex `[7x]` only matches a single '7' or 'x'); the forum being behind a CDN/anti-bot layer that replaces the HTML and removes the generator meta tag.
Common situations: The target forum upgraded to a Discuz version not yet supported by this route; the forum uses a heavily customized theme that omits or renames the generator meta tag; the forum returns an interstitial anti-bot page (e.g. a JS challenge) instead of the real HTML, so the generator meta tag is absent or reads differently.
Related errors
- 无法检测 Discuz 版本,请在路由中指定版本参数,如 /discuz/x/ 或 /discuz/7/
- Invalid category
- At least one valid search parameter is required
- 缺少对应论坛的cookie.
- 不支持指定类型!
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/cc6bb5da3a2b9fe3.
Report an issue: GitHub.