UNPKG

rsshub

Version:
32 lines (31 loc) 997 B
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as parseDate } from "./parse-date-CjhZE69i.mjs"; import { t as timezone } from "./timezone-DE--ze1V.mjs"; import { load } from "cheerio"; //#region lib/routes/gov/sh/sthj.ts const route = { path: "/sthj", categories: ["forecast"], example: "/gov/sh/sthj", name: "空气质量", maintainers: ["nczitzk"], handler }; async function handler() { const link = "https://link.sthj.sh.gov.cn/aqi/index.jsp"; const $ = load(await rofetch(link)); const aqi = $("div.val").text(); const time = `${(/* @__PURE__ */ new Date()).getFullYear()}-${$("span.t-time").eq(0).text().replaceAll(/\s+/g, "").replace("月", "-").replace("日", " ").replace("时", ":00:00")}`; return { title: "上海市生态环境局 - 空气质量", link, item: [{ title: `${aqi} - ${time}`, link, description: $("table.table").html() + $("div.air-yb").html(), pubDate: timezone(parseDate(time), 8) }] }; } //#endregion export { route };