DIYgod/RSSHub · warning · Error

No article body

Error message

No article body

What it means

After the listing is parsed, each internal article link is fetched and its body is required to extract the .v_news_content container. If articleResponse.body is falsy, the route throws 'No article body'. This is the per-article version of the listing-body check and runs inside a Promise.all, so one bad article can fail the whole feed.

Source

Thrown at lib/routes/gdufs/xwxy/index.ts:85

                let isInternal = false;
                try {
                    const u = new URL(item.link);
                    isInternal = u.hostname.endsWith('gdufs.edu.cn');
                } catch {
                    // ignore malformed URL
                }

                if (!isInternal) {
                    return {
                        ...item,
                        description: '',
                        author: '',
                    };
                }

                const articleResponse = await got(item.link);
                if (!articleResponse.body) {
                    throw new Error('No article body');
                }
                const $$ = load(articleResponse.body);
                // 使用 .v_news_content 选择器
                const $content = $$('.v_news_content');

                // 绝对化 img/src 与 a/href
                $content.find('img, a').each((_, el) => {
                    const $el = $$(el);
                    const attrs = ['src', 'href'];
                    for (const attr of attrs) {
                        const v = $el.attr(attr);
                        if (v && !v.startsWith('http')) {
                            try {
                                $el.attr(attr, new URL(v, item.link).href);
                            } catch {
                                // ignore malformed url
                            }
                        }

View on GitHub (pinned to bed535e087)

Solutions

  1. Wrap the per-article fetch so one empty body returns a partial item (empty description) instead of failing the entire feed.
  2. Retry the individual article fetch once before giving up.
  3. Cache successful article fetches so transient failures do not recur.
  4. Verify the article link is absolute/correct (relative links resolved wrong can hit a dead URL).

Example fix

// before
const articleResponse = await got(item.link);
if (!articleResponse.body) {
    throw new Error('No article body');
}

// after
const articleResponse = await got(item.link);
if (!articleResponse.body) {
    logger.warn(`Empty body for ${item.link}, returning partial item`);
    return { ...item, description: '', author: '' };
}
Defensive patterns

Strategy: fallback

Validate before calling

// pre-flight is per-article inside a loop; instead guard the fetch result

Type guard

const hasArticleBody = (r: { body: unknown }): boolean => !!r.body;

Try / catch

const articleResponse = await got(item.link).catch(() => null);
if (!articleResponse?.body) {
  return { ...item, description: '', author: '' }; // graceful degradation
}

Prevention

When it happens

Trigger: A specific article URL returns an empty body (server hiccup, the article was removed between listing and detail fetch, or a login/redirect interstitial), while the listing itself was fine. Because the fetch is in a tight loop, any single failing article surfaces this error.

Common situations: Articles being taken offline between the list fetch and the detail fetch; university servers intermittently dropping connections; rate limiting causing truncated responses.

Related errors


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