UNPKG

rsshub

Version:
36 lines (35 loc) 1.02 kB
import { n as division, r as link } from "./utils-WuwAOOYj.mjs"; //#region lib/routes/sgcc/blackout-notice-helper.ts const route = { path: "/95598/helper", categories: ["forecast"], example: "/sgcc/95598/helper", name: "停电通知地区代码", maintainers: ["TonyRL"], handler, url: "www.95598.cn/osgweb/blackoutNotice" }; async function handler(ctx) { const { origin } = new URL(ctx.req.url); const provinces = await division("-1"); const entry = (title, codeValue) => { const path = `/sgcc/95598/${codeValue}`; return { title, description: path, link: origin + path, guid: codeValue }; }; return { title: "95598 停电通知地区代码", link, language: "zh-CN", item: (await Promise.all(provinces.map(async (province) => { const cities = await division(province.codeValue); return [entry(province.codeName, province.codeValue), ...cities.map((city) => entry(`${province.codeName} ${city.codeName}`, city.codeValue))]; }))).flat() }; } //#endregion export { route };