DIYgod/RSSHub · error · Error
无法解析页面数据,请检查漫画 ID 是否正确或页面结构是否变动
Error message
无法解析页面数据,请检查漫画 ID 是否正确或页面结构是否变动
What it means
This error is thrown when the comic-fuz route fetches a manga page but the Next.js __NEXT_DATA__ script tag is empty or absent. RSSHub relies on this embedded JSON blob as its sole data source for title, author, chapters, and descriptions. When it is missing, the scraper cannot proceed because there is no alternative data path.
Source
Thrown at lib/routes/comic-fuz/manga.ts:45
maintainers: ['xiaobailoves'],
handler: async (ctx) => {
const { id } = ctx.req.param();
const baseUrl = 'https://comic-fuz.com';
const openUrl = `${baseUrl}/manga/${id}`;
const imgUrl = 'https://img.comic-fuz.com';
const response = await ofetch(openUrl, {
headers: {
'Accept-Language': 'ja,en-US;q=0.9,en;q=0.8',
},
});
const $ = load(response);
const nextDataText = $('#__NEXT_DATA__').text();
if (!nextDataText) {
throw new Error('无法解析页面数据,请检查漫画 ID 是否正确或页面结构是否变动');
}
const nextData = JSON.parse(nextDataText);
const pageProps = nextData.props?.pageProps;
if (!pageProps) {
throw new Error('无法解析页面 Props 数据');
}
const mangaTitle = $('title').text();
const mangaAuthor = pageProps.authorships?.map((item: any) => item.author?.authorName).join(', ') || '';
const mangaDescription = pageProps.manga?.longDescription || '';
const chapterGroups = pageProps.chapters || [];
const allChapters = chapterGroups.flatMap((group: any) => group.chapters || []);
const items = allChapters.map((chapter: any) => {View on GitHub (pinned to bed535e087)
Solutions
- Open the comic-fuz manga URL directly in a browser to confirm the ID is valid and the page loads normally.
- Inspect the actual HTML returned by ofetch — log or dump response to check whether a CAPTCHA or error page is being served.
- Add a realistic User-Agent and Accept headers to the ofetch call to reduce anti-bot blocking.
- If the site redesigned, locate the new data source (check for a JSON API endpoint or a different embedded script tag) and update the selector.
- Report the broken route to RSSHub maintainers if the page structure has permanently changed.
Example fix
// before
const response = await ofetch(openUrl, {
headers: {
'Accept-Language': 'ja,en-US;q=0.9,en;q=0.8',
},
});
// after — add a realistic UA and log the response for diagnosis
const response = await ofetch(openUrl, {
headers: {
'Accept-Language': 'ja,en-US;q=0.9,en;q=0.8',
'User-Agent': config.trueUA,
},
});
if (!response.includes('__NEXT_DATA__')) {
throw new Error('comic-fuz page did not contain __NEXT_DATA__; possible anti-bot block or site redesign');
} Defensive patterns
Strategy: validation
Validate before calling
// Before calling ofetch, validate the manga ID format
const id = ctx.req.param('id');
if (!id || !/^\d+$/.test(id)) {
throw new InvalidParameterError('Manga ID must be numeric');
}
// After fetching, validate HTML contains expected data
if (!response.includes('__NEXT_DATA__')) {
throw new Error('Page does not contain Next.js data; possible anti-bot block');
} Type guard
function hasNextData(html: string): boolean {
return html.includes('id="__NEXT_DATA__"') && html.match(/id="__NEXT_DATA__"[^>]*>[^<]+/) !== null;
} Try / catch
try {
const response = await ofetch(openUrl, { headers: { 'User-Agent': config.trueUA } });
const $ = load(response);
const nextDataText = $('#__NEXT_DATA__').text();
if (!nextDataText) throw new Error('No __NEXT_DATA__');
} catch (e) {
logger.error(`comic-fuz fetch failed for ID ${id}: ${(e as Error).message}`);
throw e;
} Prevention
- Always send a realistic User-Agent header when scraping Next.js sites.
- Use cache.tryGet to reduce request frequency and avoid triggering anti-bot measures.
- Validate the manga ID format before making the request.
- Monitor for site structure changes by checking the route periodically.
When it happens
Trigger: The ofetch call to the comic-fuz manga URL returns HTML, but $('#__NEXT_DATA__').text() evaluates to an empty string. This happens when the server returns a 404/error page, a CAPTCHA interstitial, or a redesigned page that no longer embeds Next.js hydration data.
Common situations: Anti-scraping middleware returns a challenge page instead of content; the manga ID in the route path does not correspond to a valid manga (resulting in a Next.js error page that still has the script tag but empty); the site undergoes a frontend migration that removes or renames the __NEXT_DATA__ element.
Related errors
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/41e95f68e7eb1304.
Report an issue: GitHub.