{"record":{"id":"4ed0f9cd8acf0062","repo":"DIYgod/RSSHub","slug":"invalid-language-4ed0f9","errorCode":null,"errorMessage":"Invalid language","messagePattern":"Invalid language","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":503,"severity":"error","filePath":"lib/routes/pornhub/pornstar.ts","lineNumber":80,"sourceCode":"        requireConfig: false,\n        requirePuppeteer: false,\n        antiCrawler: true,\n        supportBT: false,\n        supportPodcast: false,\n        supportScihub: false,\n        nsfw: true,\n    },\n    radar: getRadarDomin('/pornstar/:username'),\n    name: 'Pornstar',\n    maintainers: ['I2IMk', 'queensferryme'],\n    handler,\n};\n\nasync function handler(ctx): Promise<Data> {\n    const { language = 'www', username, sort = 'mr', img } = ctx.req.param();\n    let link = `https://${language}.pornhub.com/pornstar/${username}?o=${sort}`;\n    if (!isValidHost(language)) {\n        throw new InvalidParameterError('Invalid language');\n    }\n\n    const { data: response } = await got(link, { headers });\n    let $ = load(response);\n    let items;\n\n    const showImages = img === 'img=1';\n\n    if ($('.withBio').length === 0) {\n        link = `https://${language}.pornhub.com/pornstar/${username}/videos?o=${sort}`;\n        const { data: response } = await got(link, { headers });\n        $ = load(response);\n        items = $('#mostRecentVideosSection .videoBox')\n            .toArray()\n            .map((e) => parseItems($(e), showImages));\n    } else {\n        items = $('#pornstarsVideoSection .videoBox')\n            .toArray()","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/pornhub/pornstar.ts#L62-L98","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n/rsshub/pornhub/pornstar/somename/eng\n// after\n/rsshub/pornhub/pornstar/somename/www","handlingStrategy":"validation","validationCode":"import isValidHost from '@/utils/valid-host';\nconst language = ctx.req.param('language') ?? 'www';\nif (!isValidHost(language)) {\n    // surface a friendly message listing valid subdomains instead of throwing late\n    return ctx.body(`Unsupported language '${language}'. Use a known Pornhub subdomain.`, 400);\n}","typeGuard":"const isPornhubLocale = (v: string): boolean => typeof v === 'string' && /^[a-z]{2,6}$/.test(v) && isValidHost(v);","tryCatchPattern":null,"preventionTips":["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."],"tags":["invalid-parameter","route-validation","host-check"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}