DIYgod/RSSHub · error · InvalidParameterError
Invalid language
Error message
Invalid language
What it means
Identical pattern to pornstar.ts: the /pornhub/users/:username route injects the `:language` segment directly into the host portion of `https://${language}.pornhub.com/users/...`. `isValidHost` rejects anything that is not a known Pornhub locale subdomain before the request is sent. This protects against both typos and host-header injection through a path parameter.
Source
Thrown at lib/routes/pornhub/users.ts:34
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false,
nsfw: true,
},
radar: getRadarDomin('/users/:username'),
name: 'Users',
maintainers: ['I2IMk', 'queensferryme'],
handler,
};
async function handler(ctx): Promise<Data> {
const { language = 'www', username, img } = ctx.req.param();
const link = `https://${language}.pornhub.com/users/${username}/videos`;
if (!isValidHost(language)) {
throw new InvalidParameterError('Invalid language');
}
const { data: response } = await got(link, { headers });
const $ = load(response);
const showImages = img === 'img=1';
const items = $('.videoUList .videoBox')
.toArray()
.map((e) => parseItems($(e), showImages));
return {
title: $('.profileUserName a').text(),
description: $('.aboutMeText').text().trim(),
link,
image: $('#getAvatar').attr('src'),
language: $('html').attr('lang') as any,
allowEmpty: true,
item: items,
};View on GitHub (pinned to bed535e087)
Solutions
- Supply a recognized Pornhub subdomain token (`www`, `cn`, `jp`, …) as the language segment.
- Drop the segment to fall back to the default `'www'`.
- Validate via `isValidHost` before issuing the request.
Example fix
// before /rsshub/pornhub/users/foo/en // after /rsshub/pornhub/users/foo/www
Defensive patterns
Strategy: validation
Validate before calling
import isValidHost from '@/utils/valid-host';
const language = ctx.req.param('language') ?? 'www';
if (!isValidHost(language)) {
return ctx.body(`Unsupported language '${language}'.`, 400);
} Type guard
const isPornhubLocale = (v: unknown): v is string => typeof v === 'string' && isValidHost(v);
Prevention
- Treat the language segment as an internal subdomain token, not a free-form locale string.
- Document the accepted values inline with the route so callers do not guess.
- Prefer omitting the segment to rely on the 'www' default.
When it happens
Trigger: A request such as /pornhub/users/foo/xyz where `xyz` is not in the Pornhub subdomain allowlist. The check runs synchronously right after parameter destructuring, before `got(link)`.
Common situations: Wrong locale token supplied (e.g. `en` instead of `www`), user assumes ISO language codes work, or the segment is omitted in a way the router fills with garbage.
Related errors
- Invalid language
- Such feed is not supported.
- Such feed is not supported.
- Invalid type: ${paramType}. Please refer to [the documentati
- invalid sort parameter, should be `hot`, `created`, or `repl
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/a085d1e91417ba27.
Report an issue: GitHub.