DIYgod/RSSHub · error · Error
Cannot find the script with data-iso-key="_0"
Error message
Cannot find the script with data-iso-key="_0"
What it means
Thrown when the ScienceDirect calls-for-papers page contains no <script data-iso-key="_0"> element whose text the route can harvest. ScienceDirect embeds its page data as a JSON blob inside such an ISO (Isomorphic) script tag; absence of the tag means the SSR payload structure changed or a non-content page was returned.
Source
Thrown at lib/routes/sciencedirect/call-for-paper.tsx:34
source: ['sciencedirect.com'],
},
],
name: 'Call for Papers',
maintainers: ['etShaw-zh'],
handler,
url: 'sciencedirect.com/browse/calls-for-papers',
description: '`sciencedirect.com/browse/calls-for-papers?subject=education` -> `/sciencedirect/call-for-paper/education`',
};
async function handler(ctx) {
const { subject = '' } = ctx.req.param();
const apiUrl = `https://www.sciencedirect.com/browse/calls-for-papers?subject=${subject}`;
const response = await got(apiUrl);
const $ = load(response.body);
const scriptJSON = $('script[data-iso-key="_0"]').text();
if (!scriptJSON) {
throw new Error('Cannot find the script with data-iso-key="_0"');
}
let data;
try {
data = JSON.parse(JSON.parse(scriptJSON));
} catch (error: any) {
throw new Error(`Failed to parse embedded script JSON: ${error.message}`, { cause: error });
}
const cfpList = data?.callsForPapers?.list || [];
if (!cfpList.length) {
throw new Error('No Calls for Papers found');
}
const items = cfpList.map((cfp) => {
const link = `https://www.sciencedirect.com/special-issue/${cfp.contentId}/${cfp.url}`;
const description = renderToString(
<div>View on GitHub (pinned to bed535e087)
Solutions
- Fetch the URL with a browser UA and confirm a script[data-iso-key] element is present; note any new key value.
- If the key changed, update the selector to the new data-iso-key attribute.
- If a consent/anti-bot page is returned, add the necessary cookies/headers or use config.trueUA.
- Surface the HTTP status / partial body in the error to distinguish 'no script' from 'blocked'.
Example fix
// before
const scriptJSON = $('script[data-iso-key="_0"]').text();
if (!scriptJSON) {
throw new Error('Cannot find the script with data-iso-key="_0"');
}
// after — search all data-iso scripts for the one carrying callsForPapers
let scriptJSON = '';
let isoKey = '_0';
$('script[data-iso-key]').each((_, el) => {
const txt = $(el).text();
if (txt.includes('callsForPapers')) {
scriptJSON = txt;
isoKey = $(el).attr('data-iso-key')!;
return false;
}
});
if (!scriptJSON) {
throw new Error('Cannot find a data-iso script carrying callsForPapers data');
} Defensive patterns
Strategy: fallback
Validate before calling
// Verify the data-iso script presence with a browser-like UA before parsing.
async function hasIsoScript(subject: string): Promise<boolean> {
const html = await got(`https://www.sciencedirect.com/browse/calls-for-papers?subject=${subject}`, { headers: { 'user-agent': config.trueUA } }).then((r) => r.body);
return /<script[^>]*data-iso-key=/.test(html);
} Type guard
const hasIsoPayload = ($: cheerio.CheerioAPI): boolean =>
$('script[data-iso-key]').toArray().some((el) => $(el).text().length > 0); Try / catch
try {
return await handler(ctx);
} catch (e) {
if (e instanceof Error && /Cannot find the script with data-iso-key/.test(e.message)) {
// retry once with a full browser UA / consent cookies
return await handlerWithBrowserHeaders(ctx);
}
throw e;
} Prevention
- Send config.trueUA and any required consent cookies to bypass anti-bot pages.
- Search all data-iso scripts for the one carrying the relevant payload, rather than hard-coding _0.
- Add an integration test against a live subject to catch selector drift.
When it happens
Trigger: GET https://www.sciencedirect.com/browse/calls-for-papers?subject={subject} returns HTML in which no script has data-iso-key="_0". $('script[data-iso-key="_0"]').text() is the empty string, so scriptJSON is falsy and the guard throws.
Common situations: ScienceDirect changed its isomorphic data-iso key scheme; the response was a bot-detection/consent page rather than the real page; a regional redirect served a different shell without the ISO blob; the subject value triggered an error page.
Related errors
- Failed to retrieve JSON beatmap info from osu! website
- Unable to extract creator ID
- JavaScript file not found.
- 无法解析页面数据,请检查漫画 ID 是否正确或页面结构是否变动
- 无法解析页面 HTML 数据,可能触发了反爬策略或页面结构巨变
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/e435d33ec773bfa4.
Report an issue: GitHub.