{"record":{"id":"3cd498b2260d6ca4","repo":"DIYgod/RSSHub","slug":"failed-to-parse-the-latest-fujian-daily-edition-da","errorCode":null,"errorMessage":"Failed to parse the latest Fujian Daily edition date.","messagePattern":"Failed to parse the latest Fujian Daily edition date\\.","errorType":"exception","errorClass":"Error","httpStatus":503,"severity":"error","filePath":"lib/routes/fjdaily/index.ts","lineNumber":112,"sourceCode":"\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',\n    parameters: { date: '日期，格式为 `YYYYMMDD`，留空时抓取当天全部版面，例如 `20260316`' },\n    features: {\n        requireConfig: false,\n        requirePuppeteer: false,\n        antiCrawler: false,\n        supportBT: false,","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/fjdaily/index.ts#L94-L130","documentation":"Thrown by the Fjdaily route when the latest edition's link href was successfully found but does not match the expected URL pattern `/(\\d{6})\\/(\\d{2})\\/node_\\d+\\.html/`. The route expects a path like `202603/16/node_01.html` (6-digit yearMonth, 2-digit day, node filename). If the site changed its URL scheme, the regex match fails and yearMonth/day are undefined.","triggerScenarios":"The Fujian Daily site changes its URL structure — e.g., from `202603/16/node_01.html` to `2026/03/16/node_01.html` (different digit grouping), or to a UUID-based path, or to a query-parameter-based URL. The href is found but its format no longer matches the regex.","commonSituations":"CMS migration that changes the URL routing scheme. The index page links to a different page format during special editions (holiday editions, supplements). A relative URL that resolves differently than expected.","solutions":["Inspect the actual href value from the index page to understand the new URL format.","Update the regex `/ (\\d{6})\\/(\\d{2})\\/node_\\d+\\.html/` in getIssueDate to match the new pattern.","Pass a specific date in YYYYMMDD format to bypass the auto-detection: `/fjdaily/20260316`.","Log `latestPath` to see the exact URL being parsed."],"exampleFix":"// before\nconst [, yearMonth, day] = latestPath.match(/(\\d{6})\\/(\\d{2})\\/node_\\d+\\.html/) ?? [];\n\n// after — support both old and new URL formats\nconst match = latestPath.match(/(\\d{6})\\/(\\d{2})\\/node_\\d+\\.html/)\n    ?? latestPath.match(/(\\d{4})\\/(\\d{2})\\/(\\d{2})\\/node_\\d+\\.html/);\nconst yearMonth = match ? (match[1].length === 6 ? match[1] : match[1] + match[2]) : undefined;\nconst day = match ? (match[1].length === 6 ? match[2] : match[3]) : undefined;","handlingStrategy":"fallback","validationCode":"function parseEditionPath(href: string): { yearMonth: string; day: string } {\n    // Try multiple URL patterns\n    const patterns = [\n        /(?<ym>\\d{6})\\/(?<day>\\d{2})\\/node_\\d+\\.html/,\n        /(?<year>\\d{4})\\/(?<month>\\d{2})\\/(?<day>\\d{2})\\/node_\\d+\\.html/,\n    ];\n    for (const p of patterns) {\n        const m = href.match(p);\n        if (m?.groups) {\n            const ym = m.groups.ym ?? m.groups.year + m.groups.month;\n            return { yearMonth: ym, day: m.groups.day };\n        }\n    }\n    throw new Error(`Unrecognized edition URL format: ${href}`);\n}","typeGuard":"function matchesEditionUrlFormat(href: string): boolean {\n    return /\\d{6}\\/\\d{2}\\/node_\\d+\\.html/.test(href)\n        || /\\d{4}\\/\\d{2}\\/\\d{2}\\/node_\\d+\\.html/.test(href);\n}","tryCatchPattern":"const match = latestPath.match(/(\\d{6})\\/(\\d{2})\\/node_\\d+\\.html/);\nif (!match) {\n    // Fallback: try to extract any date-like segments\n    const fallback = latestPath.match(/(\\d{4})(\\d{2})\\/(\\d{2})/);\n    if (fallback) {\n        yearMonth = fallback[1] + fallback[2];\n        day = fallback[3];\n    } else {\n        throw new Error(`Cannot parse edition date from URL: ${latestPath}`);\n    }\n}","preventionTips":["Pass an explicit date (YYYYMMDD) to bypass URL parsing entirely.","Support multiple URL format patterns to handle CMS migrations gracefully.","Log the actual href value when parsing fails for quick diagnosis.","Monitor the Fujian Daily URL scheme after site updates."],"tags":["scraping","url-format-change","regex-breakage","fjdaily"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}