{"record":{"id":"bb92763bc47aeecb","repo":"DIYgod/RSSHub","slug":"bad-category-see-a-href-https-docs-rsshub-app-bb9276","errorCode":null,"errorMessage":"Bad category. See <a href=\"https://docs.rsshub.app/routes/new-media#mei-hua-wang-zuo-pin\">docs</a>","messagePattern":"Bad category\\. See <a href=\"https://docs\\.rsshub\\.app/routes/new-media#mei-hua-wang-zuo-pin\">docs</a>","errorType":"exception","errorClass":null,"httpStatus":503,"severity":"warning","filePath":"lib/routes-deprecated/meihua/shots.js","lineNumber":22,"sourceCode":"const config = {\n    recommend: {\n        link: 'shots!1!0!0!0!0',\n        title: '推荐',\n    },\n    latest: {\n        link: 'shots!2!0!0!0!0',\n        title: '最新',\n    },\n    hot: {\n        link: 'shots!3!0!0!0!0',\n        title: '热门',\n    },\n};\n\nmodule.exports = async (ctx) => {\n    const cfg = config[ctx.params.caty];\n    if (!cfg) {\n        throw new Error('Bad category. See <a href=\"https://docs.rsshub.app/routes/new-media#mei-hua-wang-zuo-pin\">docs</a>');\n    }\n\n    const currentUrl = `https://www.meihua.info/${cfg.link}`;\n    const response = await got({\n        method: 'get',\n        url: currentUrl,\n    });\n    const data = JSON.parse(response.data.match(/\"shotsStore\":(.*?),\"commentStore\":/)[1]);\n\n    const shotList = data.shotsData.list.map((item) => ({\n        title: item.title,\n        link: `https://www.meihua.info/shots/${item.compositionId}`,\n        pubDate: new Date(item.gmtPublish).toUTCString(),\n    }));\n\n    const items = await Promise.all(\n        shotList.map((item) =>\n            ctx.cache.tryGet(item.link, async () => {","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes-deprecated/meihua/shots.js#L4-L40","documentation":"Thrown by the Meihua shots (作品) route (deprecated) when :caty is not a config key. Config maps slugs (e.g. a 'latest' key → shots!2!0!0!0!0 最新, hot → shots!3!0!0!0!0 热门) to multi-field tokens. Miss throws before the scrape and JSON.parse of shotsStore.","triggerScenarios":"Request with a :caty absent from config; the guard throws.","commonSituations":"Slug typo, or confusing this route's slugs with the article route's (article! vs shots!). The token format (five !-separated fields) also breaks easily if Meihua changes its filter encoding.","solutions":["Use a documented slug (e.g. hot).","Confirm keys against the config map at the top of lib/routes-deprecated/meihua/shots.js.","Distinguish this route from meihua/article.js — different config tokens."],"exampleFix":"// before\nGET /meihua/shots/latestt   // typo\n// after\nGET /meihua/shots/hot         // 热门","handlingStrategy":"validation","validationCode":"const VALID = ['hot' /* + latest key — see config in lib/routes-deprecated/meihua/shots.js */];\nif (!VALID.includes(ctx.params.caty)) throw new Error(`Invalid caty. Valid: ${VALID.join(', ')}`);","typeGuard":"const isCaty = (v: string): v is 'hot' => v === 'hot';","tryCatchPattern":"try { await fetch(route); }\ncatch (e) {\n  if (/Bad category/.test(e.message)) listSlugs();\n  else if (/shotsStore/.test(String(e))) reportMarkupChange();\n  else throw e;\n}","preventionTips":["The five-field token format is fragile — verify against live site.","Don't confuse with meihua/article."],"tags":["rsshub","parameter-validation","deprecated-route","new-media"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}