mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
* feat(route): add 国际能源网 (in-en.com) news route Add RSS route for in-en.com (国际能源网), a major Chinese energy news portal. Supported channels via /in-en/news/:type: - solar — 光伏太阳能 - wind — 风电 - chuneng — 储能 - h2 — 氢能 - chd — 充换电 - newenergy — 新能源综合 - power — 电力 - huanbao — 环保 Features: fetches article list from each subdomain's news page, then retrieves full article body via detail page (cached). Handles Chinese relative timestamps (X分钟/小时/天前). * fix(in-en): add maintainer, fix timezone double-shift, translate comments to English * fix(in-en): correct news paths for h2/chd/huanbao, drop date-only pubDate override * fix(in-en): sort imports, fix numeric separators, add category field, use trueUA * fix(in-en): address review comments - Remove config.trueUA, use default UA - Remove custom parseRelTime, use parseDate directly - Fix title text extraction without cloning element - Remove unnecessary .first() on pubDate - Fix author: handle both em.ly and plain-text source via .prompt > span - Simplify category field (remove redundant length check) - Fix description selector: .article-body → #article - Fix detail author selector: .article-meta .source a → p.source a - Remove try-catch around detail fetch * fix(in-en): fix author including category text and handle relative pubDate formats * fix(in-en): use parseRelativeDate, simplify selectors, drop redundant fallbacks - Replace hand-rolled relative-date logic with parseRelativeDate (covers "刚刚 / N分钟前 / N小时前 / 今天 HH:MM / 昨天 HH:MM / YYYY-MM-DD"). Fixes Invalid Date on the first few entries and resolves the two oxlint findings (no-useless-undefined, numeric-separators-style). - Drop the `.first()` on `.listTxt .prompt i` — each `ul.infoList > li` carries exactly one `<i>` (date), confirmed against https://solar.in-en.com/news/. - Author selector: `.prompt > span:first-of-type`, then strip leading "来源:". Cheerio's `.text()` flattens `<em class="ly">…</em>` into the same string, so this matches both shapes shown on https://solar.in-en.com/news/ (plain text vs. wrapped in em.ly). - Category selector: `.prompt > span:not(:first-of-type) em a`, scoped to the second span so author text never leaks in. - Drop `|| undefined` on author and `?? ''` on description (redundant — DataItem already accepts undefined). - Add an HTML-shape comment pointing to the live sample URL so future reviewers can verify the layout assumptions. * fix(in-en): drop dead default + use new-media category - Hono treats `:type` as compulsory (path is `/news/:type`), so users without it never reach the handler — the `?? 'solar'` fallback was unreachable. Replace with a non-null assertion to keep the type narrow. - categories: 'traditional-media' → 'new-media' per review suggestion.