DIYgod/RSSHub · error · Error
无法解析页面数据,请检查杂志 ID 是否正确或页面结构是否变动
Error message
无法解析页面数据,请检查杂志 ID 是否正确或页面结构是否变动
What it means
Thrown by the comic-fuz magazine route when the loaded page contains no `#__NEXT_DATA__` script tag (or its text is empty). comic-fuz is a Next.js app that embeds server-rendered state in that tag; absence means the page did not render the expected React payload. Plain `Error` with a Chinese message: 'Cannot parse page data, check the magazine ID or whether the page structure changed.'
Source
Thrown at lib/routes/comic-fuz/magazine.ts:45
maintainers: ['xiaobailoves'],
handler: async (ctx) => {
const { id } = ctx.req.param();
const baseUrl = 'https://comic-fuz.com';
const openUrl = `${baseUrl}/magazine/${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 magazineTitle = pageProps.magazineName || '';
const magazineDescription = pageProps.pickupMagazineIssue?.longDescription || '';
const issues = pageProps.magazineIssues || [];
const items = issues.map((item: any) => {
const amount = item.paidPoint || 0;
const statusText = amount > 0 ? '付费' : '无料';View on GitHub (pinned to bed535e087)
Solutions
- Open `openUrl` in a browser and confirm the page shows the magazine; verify `#__NEXT_DATA__` exists in view-source.
- If the tag is gone site-wide, the route must switch to a different data source (e.g. a comic-fuz JSON API) — scraping __NEXT_DATA__ no longer works.
- Verify the magazine ID format against the example in the route description.
- Retry to rule out an intermittent block page.
Defensive patterns
Strategy: validation
Validate before calling
const nextDataText = $('#__NEXT_DATA__').text();
if (!nextDataText) {
// surface a clearer error including response status and url
throw new Error(`No __NEXT_DATA__ at ${openUrl} (status ${response.status ?? 'n/a'}); magazine id may be wrong or site restructured`);
} Type guard
function hasNextData($: cheerio.Root): boolean {
return $('#__NEXT_DATA__').text().length > 0;
} Prevention
- Confirm the magazine id format against the route's documented example.
- If `#__NEXT_DATA__` disappears site-wide, comic-fuz likely migrated off the Pages Router — switch to a JSON API source.
- Check for a CAPTCHA/block page in the response body before assuming a layout change.
When it happens
Trigger: Wrong/non-existent magazine ID (comic-fuz returns a generic landing or 404 page without __NEXT_DATA__); comic-fuz upgraded Next.js and renamed/moved the tag (e.g. App Router uses different serialization); request was blocked and returned a CAPTCHA/error page; Accept-Language or other header triggered a different response.
Common situations: User copies a magazine code that is actually an issue id, or the site migrates from Pages Router (which uses `#__NEXT_DATA__`) to App Router (which does not embed it the same way).
Related errors
- No articles found.
- 无法解析页面 Props 数据
- Unknown content type for link: ${link}
- missing next data
- Bilibili browser response does not contain video list data
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/9e18986dc7f98cce.
Report an issue: GitHub.