DIYgod/RSSHub · error · Error
Failed to locate the latest Fujian Daily edition.
Error message
Failed to locate the latest Fujian Daily edition.
What it means
Thrown by the Fjdaily route's `getIssueDate` function when scraping the index page at `fjrb.fjdaily.com/pc/col/index.html` fails to find a link element matching `#list li:first-child a`. This means the Fujian Daily website either changed its HTML structure, returned an error page, or the expected navigation list is absent. The error fires after the HTTP request succeeds but the cheerio selector returns no href.
Source
Thrown at lib/routes/fjdaily/index.ts:106
const getIssueDate = async (date: string | undefined) => {
if (date) {
if (!/^\d{8}$/.test(date)) {
throw new Error('Invalid date format. Expected YYYYMMDD, for example `20260316`. ');
}
return {
yearMonth: date.slice(0, 6),
day: date.slice(6, 8),
};
}
const indexResponse = await got(`${ROOT_URL}/pc/col/index.html`);
const $ = load(indexResponse.data);
const latestPath = $('#list li:first-child a').attr('href');
if (!latestPath) {
throw new Error('Failed to locate the latest Fujian Daily edition.');
}
const [, yearMonth, day] = latestPath.match(/(\d{6})\/(\d{2})\/node_\d+\.html/) ?? [];
if (!yearMonth || !day) {
throw new Error('Failed to parse the latest Fujian Daily edition date.');
}
return {
yearMonth,
day,
};
};
export const route: Route = {
path: '/:date?',
categories: ['traditional-media'],
example: '/fjdaily/20260316',View on GitHub (pinned to bed535e087)
Solutions
- Open `https://fjrb.fjdaily.com/pc/col/index.html` in a browser and inspect the HTML to find the new selector for the latest edition link.
- Update the cheerio selector `#list li:first-child a` in lib/routes/fjdaily/index.ts to match the current HTML structure.
- If the site is under maintenance, retry later.
- Pass a specific date (YYYYMMDD) to bypass the index-scraping logic entirely: `/fjdaily/20260316`.
Example fix
// before
const latestPath = $('#list li:first-child a').attr('href');
// after — use a more resilient selector or multiple fallbacks
const latestPath = $('#list li:first-child a').attr('href')
|| $('a[href*="/node_"]').first().attr('href'); Defensive patterns
Strategy: fallback
Validate before calling
// Before relying on the scraped selector, verify the page structure
async function fetchLatestPath(rootUrl: string): Promise<string> {
const response = await got(`${rootUrl}/pc/col/index.html`);
const $ = load(response.data);
const path = $('#list li:first-child a').attr('href');
if (!path) {
throw new Error('Index page structure changed — selector #list li:first-child a returned no href');
}
return path;
} Type guard
function hasValidLatestPath($: cheerio.CheerioAPI): boolean {
return $('#list li:first-child a').attr('href') !== undefined;
} Try / catch
try {
const latestPath = await fetchLatestPath(ROOT_URL);
// ... proceed
} catch (e) {
// Fallback: let the user provide a date explicitly
throw new Error('Could not auto-detect the latest edition. Please provide a date in YYYYMMDD format: /fjdaily/20260316');
} Prevention
- Pass an explicit date (YYYYMMDD) to bypass index-page scraping entirely.
- Monitor the Fujian Daily website for structural changes after CMS updates.
- Use resilient selectors with fallbacks (e.g., try multiple selector patterns).
- Log the page HTML when the selector fails so breakages are diagnosed quickly.
When it happens
Trigger: The Fujian Daily website redesigns its index page and the `#list` container or `li:first-child a` selector no longer matches. The site returns a maintenance page or redirect HTML. The site is temporarily returning a compressed or differently-encoded response that cheerio cannot parse into the expected DOM.
Common situations: Website layout change after a CMS migration. Temporary maintenance page replacing the normal index. CDN or WAF returning a challenge page (e.g., Cloudflare interstitial) instead of the actual HTML. The site was restructured with different container IDs.
Related errors
- No articles were found for ${yearMonth}${day}.
- Failed to parse the latest Fujian Daily edition date.
- this route is empty, please check the original site or <a hr
- Unknown type: ${item.type}
- Comic Not Found - ${name}
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/52c3318c9794fb79.
Report an issue: GitHub.