DIYgod/RSSHub · error · InvalidParameterError
请填入合法的用户 id,参见用户排名 https://www.jisilu.cn/users/
Error message
请填入合法的用户 id,参见用户排名 https://www.jisilu.cn/users/
What it means
Thrown by the jisilu people handler as InvalidParameterError when the regex `/var\s+PEOPLE_USER_ID\s=\s'(\d+)';/` does not match against the fetched /people/<id> page HTML, leaving userId undefined. Without userId the handler cannot build the AJAX endpoint `people/ajax/user_actions/uid-<id>__actions-<code>__page-1`.
Source
Thrown at lib/routes/jisilu/people.ts:35
export const handler = async (ctx: Context): Promise<Data> => {
const { id, type = 'questions' } = ctx.req.param();
if (type && type !== 'answers' && type !== 'questions') {
throw new InvalidParameterError('请填入合法的类型 id,可选值为 `questions` 即 `主题` 或 `answer` 即 `回复`,默认为空,即全部');
}
const limit = Number(ctx.req.query('limit') ?? '30');
const targetUrl: string = new URL(`/people/${id}`, rootUrl).href;
const response = await ofetch(targetUrl);
const $: CheerioAPI = load(response);
const language: string = $('html').prop('lang') ?? 'zh';
const userId: string | undefined = response.match(/var\sPEOPLE_USER_ID\s=\s'(\d+)';/)?.[1];
if (!userId) {
throw new InvalidParameterError('请填入合法的用户 id,参见用户排名 https://www.jisilu.cn/users/');
}
const apiUrl: string = new URL(`people/ajax/user_actions/uid-${userId}__actions-${actions[type]}__page-1`, rootUrl).href;
const detailResponse = await ofetch(apiUrl);
const $$: CheerioAPI = load(detailResponse);
const items: DataItem[] = await processItems($$, $$('*') as Cheerio<Element>, limit);
const author = $('meta[name="keywords"]').prop('content').split(/,/, 1)[0];
const feedImage = $('div.aw-logo img').prop('src');
return {
title: `${$('title').text()}${type ? ` - ${$(`div#${type} h3`).text()}` : ''}`,
description: $('meta[name="description"]').prop('content'),
link: targetUrl,
item: items,
allowEmpty: true,View on GitHub (pinned to bed535e087)
Solutions
- Confirm the user id exists by opening https://www.jisilu.cn/people/<id> and checking it shows a real profile (not a 404)
- If the variable was renamed, update the regex in lib/routes/jisilu/people.ts:30 to the new pattern
- Verify ofetch actually received the profile HTML (not a login wall or challenge) by logging a snippet of the response
- Consider extracting the userId from a JSON island or a data-* attribute if 集思录 migrated away from inline globals
Example fix
// before
const userId: string | undefined = response.match(/var\sPEOPLE_USER_ID\s=\s'(\d+)';/)?.[1];
if (!userId) {
throw new InvalidParameterError('请填入合法的用户 id ...');
}
// after
const userId: string | undefined =
response.match(/var\s+PEOPLE_USER_ID\s*=\s*'(\d+)';/)?.[1]
?? load(response)('[data-uid]').attr('data-uid');
if (!userId) {
throw new InvalidParameterError(`请填入合法的用户 id (got '${id}'), 参见 https://www.jisilu.cn/users/`);
} Defensive patterns
Strategy: try-catch
Validate before calling
// Probe whether the user page exposes a PEOPLE_USER_ID before parsing
async function userPageHasId(targetUrl: string): Promise<boolean> {
const resp = await ofetch(targetUrl);
return /var\s+PEOPLE_USER_ID\s*=\s*'\d+';/.test(resp);
} Type guard
function hasUserId(match: RegExpMatchArray | null): match is RegExpMatchArray {
return match !== null && /^\d+$/.test(match[1]);
} Try / catch
try {
return await handler(ctx);
} catch (e) {
if (e instanceof InvalidParameterError && /用户 id/.test(e.message)) {
// could be a deleted user or a template change — re-throw with the URL for diagnosis
throw new InvalidParameterError(`Could not resolve user id at ${targetUrl}: user deleted or site restructured`);
}
throw e;
} Prevention
- Maintain multiple extraction strategies for the userId (inline global, data-attribute, JSON island)
- Verify the user exists before subscribing (open the profile URL)
- Pin a User-Agent so anti-bot pages don't replace the profile HTML
- Log response length/snippet when the regex misses
When it happens
Trigger: The /people/<id> page loads (HTTP 200) but no longer contains the inline `var PEOPLE_USER_ID = '<digits>';` declaration — either because the id is invalid and the site shows a 'user not found' page, the user was deleted, or 集思录 restructured its template and renamed the variable.
Common situations: Wrong/non-existent user id; user account deleted/suspended; site template rebuilt renaming PEOPLE_USER_ID; anti-bot interstitial page returned instead of the profile.
Related errors
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/7920b33d79d9b618.
Report an issue: GitHub.