{"record":{"id":"52c3318c9794fb79","repo":"DIYgod/RSSHub","slug":"failed-to-locate-the-latest-fujian-daily-edition","errorCode":null,"errorMessage":"Failed to locate the latest Fujian Daily edition.","messagePattern":"Failed to locate the latest Fujian Daily edition\\.","errorType":"exception","errorClass":"Error","httpStatus":503,"severity":"error","filePath":"lib/routes/fjdaily/index.ts","lineNumber":106,"sourceCode":"\nconst getIssueDate = async (date: string | undefined) => {\n    if (date) {\n        if (!/^\\d{8}$/.test(date)) {\n            throw new Error('Invalid date format. Expected YYYYMMDD, for example `20260316`. ');\n        }\n\n        return {\n            yearMonth: date.slice(0, 6),\n            day: date.slice(6, 8),\n        };\n    }\n\n    const indexResponse = await got(`${ROOT_URL}/pc/col/index.html`);\n    const $ = load(indexResponse.data);\n    const latestPath = $('#list li:first-child a').attr('href');\n\n    if (!latestPath) {\n        throw new Error('Failed to locate the latest Fujian Daily edition.');\n    }\n\n    const [, yearMonth, day] = latestPath.match(/(\\d{6})\\/(\\d{2})\\/node_\\d+\\.html/) ?? [];\n\n    if (!yearMonth || !day) {\n        throw new Error('Failed to parse the latest Fujian Daily edition date.');\n    }\n\n    return {\n        yearMonth,\n        day,\n    };\n};\n\nexport const route: Route = {\n    path: '/:date?',\n    categories: ['traditional-media'],\n    example: '/fjdaily/20260316',","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/fjdaily/index.ts#L88-L124","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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`."],"exampleFix":"// before\nconst latestPath = $('#list li:first-child a').attr('href');\n\n// after — use a more resilient selector or multiple fallbacks\nconst latestPath = $('#list li:first-child a').attr('href')\n    || $('a[href*=\"/node_\"]').first().attr('href');","handlingStrategy":"fallback","validationCode":"// Before relying on the scraped selector, verify the page structure\nasync function fetchLatestPath(rootUrl: string): Promise<string> {\n    const response = await got(`${rootUrl}/pc/col/index.html`);\n    const $ = load(response.data);\n    const path = $('#list li:first-child a').attr('href');\n    if (!path) {\n        throw new Error('Index page structure changed — selector #list li:first-child a returned no href');\n    }\n    return path;\n}","typeGuard":"function hasValidLatestPath($: cheerio.CheerioAPI): boolean {\n    return $('#list li:first-child a').attr('href') !== undefined;\n}","tryCatchPattern":"try {\n    const latestPath = await fetchLatestPath(ROOT_URL);\n    // ... proceed\n} catch (e) {\n    // Fallback: let the user provide a date explicitly\n    throw new Error('Could not auto-detect the latest edition. Please provide a date in YYYYMMDD format: /fjdaily/20260316');\n}","preventionTips":["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."],"tags":["scraping","selector-breakage","site-structure-change","fjdaily"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}