DIYgod/RSSHub · error · Error
response.message
Error message
response.message
What it means
Plain Error thrown by the Pornhub category handler when the webmasters API response carries a truthy code field. The Pornhub /webmasters/search?category=... endpoint returns an error object (with code and message) instead of a video list on failure; RSSHub re-throws response.message verbatim. Because the message comes from upstream, its exact text varies (e.g. invalid category, rate limit, server error).
Source
Thrown at lib/routes/pornhub/category.ts:52
const { data } = await got(`${defaultDomain}/webmasters/categories`);
return data.categories;
});
const categoryId = Number.isNaN(category) ? categories.find((item) => item.category === category)?.id : category;
const categoryName = Number.isNaN(category) ? category : categories.find((item) => item.id === Number.parseInt(category)).category;
const response = await cache.tryGet(
`pornhub:category:${categoryName}`,
async () => {
const { data } = await got(`${defaultDomain}/webmasters/search?category=${categoryName}`);
return data;
},
config.cache.routeExpire,
false
);
if (response.code) {
throw new Error(response.message);
}
const showImages = img === 'img=1';
const list = response.videos.map((item) => ({
title: item.title,
link: item.url,
description: renderDescription({ thumbs: item.thumbs }, showImages),
pubDate: parseDate(item.publish_date),
category: [...new Set([...item.tags.map((t) => t.tag_name), ...item.categories.map((c) => c.category)])],
}));
return {
title: `Pornhub - ${categoryName}`,
link: `${defaultDomain}/video?c=${categoryId}`,
item: list,
};
}View on GitHub (pinned to bed535e087)
Solutions
- Use a category name from https://www.pornhub.com/webmasters/categories.
- Clear the 'pornhub:category:{name}' and 'pornhub:categories' cache entries to re-fetch fresh data.
- If rate-limited, reduce polling frequency.
- Retry once to rule out a transient Pornhub error.
Defensive patterns
Strategy: try-catch
Validate before calling
function looksLikeErrorResponse(resp: any): boolean {
return Boolean(resp && resp.code);
}
// after the cached fetch:
if (looksLikeErrorResponse(response)) {
// surface response.message; optionally clear the 'pornhub:category:{name}' cache
} Type guard
const isPornhubErrorResponse = (r: unknown): r is { code: number | string; message: string } =>
typeof r === 'object' && r !== null && Boolean((r as any).code) && typeof (r as any).message === 'string'; Try / catch
try {
const response = await cache.tryGet(`pornhub:category:${categoryName}`, /* ... */);
if (response.code) throw new Error(response.message);
} catch (e) {
// message originates from Pornhub; clear cache and/or advise a valid category
} Prevention
- Use category names from the official webmasters/categories list.
- Clear the 'pornhub:categories' and per-category cache when an upstream error appears.
- Throttle polling to avoid Pornhub rate-limit responses.
When it happens
Trigger: The category name passed in :caty does not match any Pornhub webmasters category; Pornhub API rate-limited the instance; transient Pornhub server error; category ID/name resolution produced an empty/invalid categoryName.
Common situations: Misspelled category; category removed from Pornhub; cached 'pornhub:categories' list stale so name->id lookup fails; aggressive polling triggering rate limits.
Related errors
- 中国政府网搜索接口请求失败,错误代码:${response?.resultCode?.code ?? '未知'}
- ${response.return_msg}
- ${response.data.return_msg}
- Failed to get series data
- Invalid data received from API
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/a0d7fd5b6f7ad487.
Report an issue: GitHub.