DIYgod/RSSHub · error · Error

article api error

Error message

article api error

What it means

Same `apiSuccessAssert` pattern in the SCUT JWC school-level notice route. Throws `'article api error'` when `data.success` is falsy for any article detail call.

Source

Thrown at lib/routes/scut/jwc/school.ts:41

};

const generateArticlePubDate = (createDateStr) => {
    const date = new Date(createDateStr);
    date.setHours(8);
    date.setMinutes(0);
    date.setSeconds(0);
    date.setMilliseconds(0);

    return timezone(date, 8);
};

const isRedirectPage = (data) => !!data.link;

const resolveRelativeUrl = (html) => html.replaceAll('src="/', () => `src="${new URL('.', baseUrl).href}`).replaceAll('href="/', () => `href="${new URL('.', baseUrl).href}`);

const apiSuccessAssert = (data) => {
    if (!data.success) {
        throw new Error('article api error');
    }
};

const generateArticleLink = (id) => `<p>链接:<a href="${getArticleUrlById(id)}">电脑版</a>&nbsp;|&nbsp;<a href="${getArticleMobileUrlById(id)}">手机版</a></p>`;

const generateArticleFullText = (data) => resolveRelativeUrl(data.content) + generateArticleLink(data.id);

export const route: Route = {
    path: '/jwc/school/:category?',
    categories: ['university'],
    example: '/scut/jwc/school/all',
    parameters: { category: '通知分类,默认为 `all`' },
    features: {
        requireConfig: false,
        requirePuppeteer: false,
        antiCrawler: false,
        supportBT: false,
        supportPodcast: false,

View on GitHub (pinned to bed535e087)

Solutions

  1. Retry the feed after a brief wait.
  2. Examine the detail API response directly to determine if the schema changed or the id is genuinely invalid.
  3. Modify the handler to skip failing items instead of aborting the entire feed.

Example fix

// before
const apiSuccessAssert = (data) => {
    if (!data.success) {
        throw new Error('article api error');
    }
};

// after
const apiSuccessAssert = (data) => {
    if (!data.success) {
        console.warn('article api returned success=false for id', data.id);
    }
};
Defensive patterns

Strategy: try-catch

Validate before calling

const data = await fetchArticle(id);
if (!data?.success) return null;

Type guard

const isArticleSuccess = (d: unknown): boolean => Boolean((d as any)?.success);

Try / catch

try { apiSuccessAssert(data); } catch (e) {
    if (e instanceof Error && e.message === 'article api error') continue;
    throw e;
}

Prevention

When it happens

Trigger: A school notice id in the fetched list returns `success: false` from the detail API (revoked notice, archived, backend error).

Common situations: Notice revoked between list and detail fetch; upstream API schema or auth change; intermittent backend failure.

Related errors


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