DIYgod/RSSHub · error · Error
Unknown content type for link: ${link}
Error message
Unknown content type for link: ${link} What it means
Thrown by `getContentType` in chikubi/utils.ts when a post link does not contain any of the recognised path fragments. Recognised patterns: doujin → ['/cg/', '/comic/', '/voice/'], video → ['/nipple-video/'], article → ['/post-']. Any link missing all of these falls through.
Source
Thrown at lib/routes/chikubi/utils.ts:36
title: '.article_title',
description: ['.article_icatch', '.article_contents'],
},
};
function getContentType(link: string): keyof typeof CONTENT_TYPES {
const typePatterns = {
doujin: ['/cg/', '/comic/', '/voice/'],
video: ['/nipple-video/'],
article: ['/post-'],
};
for (const [type, patterns] of Object.entries(typePatterns)) {
if (patterns.some((pattern) => link.includes(pattern))) {
return type as keyof typeof CONTENT_TYPES;
}
}
throw new Error(`Unknown content type for link: ${link}`);
}
export async function processItems(list): Promise<DataItem[]> {
const items = await Promise.all(
list.map((item) =>
cache.tryGet(item.link, async () => {
const detailResponse = await got(item.link);
const $ = load(detailResponse.data);
const contentType = getContentType(item.link);
const selectors = CONTENT_TYPES[contentType];
const title = $(selectors.title).text().trim() || item.title;
const description = processDescription(selectors.description.map((selector) => $(selector).prop('outerHTML')).join(''));
const pubDateStr = $('meta[property="article:published_time"]').attr('content');
const pubDate = pubDateStr ? parseDate(pubDateStr) : undefined;
View on GitHub (pinned to bed535e087)
Solutions
- Inspect the failing link value (it is included in the message) to see the actual path.
- If the path is a legitimate new content type, add its prefix to the relevant array in `typePatterns` (or create a new type with matching `CONTENT_TYPES` selectors).
- If links are coming through without their prefix, check how `item.link` is built upstream — likely missing `rootUrl` concatenation.
Example fix
// before
const typePatterns = {
doujin: ['/cg/', '/comic/', '/voice/'],
video: ['/nipple-video/'],
article: ['/post-'],
};
// after — add newly observed prefix
const typePatterns = {
doujin: ['/cg/', '/comic/', '/voice/'],
video: ['/nipple-video/', '/video-post/'],
article: ['/post-'],
}; Defensive patterns
Strategy: validation
Validate before calling
const PATTERNS = ['/cg/', '/comic/', '/voice/', '/nipple-video/', '/post-'];
function matchesKnownPattern(link: string): boolean {
return PATTERNS.some((p) => link.includes(p));
}
if (!matchesKnownPattern(link)) {
// log link, skip item, or extend PATTERNS
} Type guard
function isKnownContentType(link: string): boolean {
return ['/cg/', '/comic/', '/voice/', '/nipple-video/', '/post-'].some((p) => link.includes(p));
} Prevention
- Log the offending link — it is in the error message — to spot new content prefixes quickly.
- When chikubi.jp adds a section, extend `typePatterns` and `CONTENT_TYPES` together.
- Defensively skip (rather than throw) for unrecognised links so one new prefix does not kill the whole feed.
When it happens
Trigger: chikubi.jp publishes content under a new URL prefix not in the pattern list (e.g. a new '/news/' or '/special/' section), or a list item's href is relative/empty and the rootUrl prefix masks the real path.
Common situations: Site restructure adds a content type the route author never saw, or an item link is malformed (e.g. just '#', or a protocol-relative '//cdn.chikubi.jp/...').
Related errors
- No articles found.
- 无法解析页面数据,请检查杂志 ID 是否正确或页面结构是否变动
- 无法解析页面 Props 数据
- Bilibili browser response does not contain video list data
- Failed to fetch announcements, error code: ' + result?.code
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/c6f1563fc542ce08.
Report an issue: GitHub.