DIYgod/RSSHub · warning · InvalidParameterError
Invalid language
Error message
Invalid language
What it means
InvalidParameterError thrown by the Pornhub model handler when the language path segment fails isValidHost. Identical guard to the category_url route: the language is interpolated into https://{language}.pornhub.com/model/... and must be a valid DNS-label subdomain, otherwise the request is rejected before fetching.
Source
Thrown at lib/routes/pornhub/model.ts:41
requireConfig: false,
requirePuppeteer: false,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false,
nsfw: true,
},
radar: getRadarDomin('/model/:username'),
name: 'Model',
maintainers: ['I2IMk', 'queensferryme'],
handler,
};
async function handler(ctx): Promise<Data> {
const { language = 'www', username, sort = '', img } = ctx.req.param();
const link = `https://${language}.pornhub.com/model/${username}/videos${sort ? `?o=${sort}` : ''}`;
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 = $('#mostRecentVideosSection .videoBox')
.toArray()
.map((e) => parseItems($(e), showImages));
return {
title: $('h1').first().text(),
description: $('section.aboutMeSection').text().trim(),
link,
image: $('#getAvatar').attr('src'),
language: $('html').attr('lang') as any,
item: items,
};
}View on GitHub (pinned to bed535e087)
Solutions
- Use a bare lowercase Pornhub language subdomain code such as www, cn, jp, fr, de.
- Keep the segment free of dots, slashes, spaces, and special characters.
- Omit language to default to 'www'.
- Verify the subdomain exists (e.g. https://cn.pornhub.com) before using a code.
Example fix
// before: /pornhub/model/username/www. // after: /pornhub/model/username/www
Defensive patterns
Strategy: validation
Validate before calling
import { isValidHost } from '@/utils/valid-host';
function isValidLanguageSegment(lang: string): boolean {
return typeof lang === 'string' && lang.length > 0 && isValidHost(lang);
}
if (!isValidLanguageSegment(language)) {
// reject before building the pornhub model URL
} Type guard
const isValidLanguageSegment = (lang: unknown): lang is string =>
typeof lang === 'string' && /^[\dA-Z](?:[\dA-Z-]{0,61}[\dA-Z])?$/i.test(lang); Try / catch
try {
// model handler
} catch (e) {
if (e instanceof InvalidParameterError && /Invalid language/.test(e.message)) {
// surface allowed language subdomain codes
}
} Prevention
- Restrict language to bare subdomain codes (www, cn, jp, ...).
- Reject segments containing dots, slashes, spaces, or special characters.
- Default to 'www' when the segment is omitted.
When it happens
Trigger: Passing a language segment containing dots, slashes, underscores, spaces, special characters, or an empty string; using a full locale identifier instead of a bare subdomain code.
Common situations: User passes 'en-US' style locales; adds a trailing dot or slash; leaves an encoded character; uses a code Pornhub lacks a subdomain for.
Related errors
- Invalid language
- Invalid category
- At least one valid search parameter is required
- 无法检测 Discuz 版本,请在路由中指定版本参数,如 /discuz/x/ 或 /discuz/7/
- 通知类型${typeParam}未定义
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/437aab21183a68b2.
Report an issue: GitHub.