DIYgod/RSSHub · error · Error

Unknown content type for 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.

Solutions

  1. Inspect the failing link value (it is included in the message) to see the actual path.
  2. 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).
  3. 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

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


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/c6f1563fc542ce08. Report an issue: GitHub.

Appendix: 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)