DIYgod/RSSHub · error · InvalidParameterError
Invalid language
Error message
Invalid language
What it means
The route /pornhub/pornstar/:username accepts a :language path segment that becomes the subdomain of pornhub.com (e.g. `www`, `cn`). `isValidHost(language)` checks the value against an allowlist of recognized Pornhub locale subdomains; when it returns false the handler rejects the request before any network call. The throw is a fast-fail guard so an arbitrary host string is never concatenated into the outbound URL.
Source
Thrown at lib/routes/pornhub/pornstar.ts:80
requireConfig: false,
requirePuppeteer: false,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
nsfw: true,
},
radar: getRadarDomin('/pornstar/:username'),
name: 'Pornstar',
maintainers: ['I2IMk', 'queensferryme'],
handler,
};
async function handler(ctx): Promise<Data> {
const { language = 'www', username, sort = 'mr', img } = ctx.req.param();
let link = `https://${language}.pornhub.com/pornstar/${username}?o=${sort}`;
if (!isValidHost(language)) {
throw new InvalidParameterError('Invalid language');
}
const { data: response } = await got(link, { headers });
let $ = load(response);
let items;
const showImages = img === 'img=1';
if ($('.withBio').length === 0) {
link = `https://${language}.pornhub.com/pornstar/${username}/videos?o=${sort}`;
const { data: response } = await got(link, { headers });
$ = load(response);
items = $('#mostRecentVideosSection .videoBox')
.toArray()
.map((e) => parseItems($(e), showImages));
} else {
items = $('#pornstarsVideoSection .videoBox')
.toArray()View on GitHub (pinned to bed535e087)
Solutions
- Use one of the documented Pornhub subdomain language codes, most commonly `www` (default), `cn`, `jp`, `fr`, `de`, etc. — match the subdomain that appears on pornhub.com for the desired locale.
- Omit the language segment entirely so it defaults to `'www'` as defined in the destructure: `const { language = 'www', ... } = ctx.req.param()`.
- Verify the value with `isValidHost` (imported from `@/utils/valid-host`) client-side before submitting the route.
Example fix
// before /rsshub/pornhub/pornstar/somename/eng // after /rsshub/pornhub/pornstar/somename/www
Defensive patterns
Strategy: validation
Validate before calling
import isValidHost from '@/utils/valid-host';
const language = ctx.req.param('language') ?? 'www';
if (!isValidHost(language)) {
// surface a friendly message listing valid subdomains instead of throwing late
return ctx.body(`Unsupported language '${language}'. Use a known Pornhub subdomain.`, 400);
} Type guard
const isPornhubLocale = (v: string): boolean => typeof v === 'string' && /^[a-z]{2,6}$/.test(v) && isValidHost(v); Prevention
- Default the language segment to 'www' in client URLs so the common case never hits the validator.
- Keep a documented list of supported Pornhub locale subdomains next to your route config.
- Run a preflight check that calls isValidHost before subscribing users to the feed.
When it happens
Trigger: Issuing a request like /pornhub/pornstar/somename/zz where `zz` is not a valid Pornhub subdomain (typos, unknown locale codes, or injection attempts). The check fires immediately after `ctx.req.param()` extracts `language`, before `got(link)` is called.
Common situations: User mistypes the language segment (e.g. `ww` instead of `www`), copies a route example with an unsupported locale, or passes a value like `english` instead of the expected subdomain token.
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/4ed0f9cd8acf0062.
Report an issue: GitHub.