UNPKG

rsshub

Version:
44 lines (43 loc) 1.51 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as parseDate } from "./parse-date-CjhZE69i.mjs"; import { t as cache_default } from "./cache-CiDoUSLo.mjs"; import { load } from "cheerio"; //#region lib/routes/gov/wuhan/wehdz.ts const route = { path: "/wehdz/:caty", categories: ["government"], example: "/gov/wuhan/wehdz/tz_68628", parameters: { caty: "类别" }, name: "武汉东湖新技术开发区 - 光谷新闻", maintainers: ["tudou027"], handler, description: `| 通知公告 | 光谷要闻 | 产业动态 | | :-------: | :---------: | :---------: | | tz\\_68628 | ggxw\\_68629 | cydt\\_68630 |` }; const rootUrl = "https://www.wehdz.gov.cn"; async function handler(ctx) { const { caty } = ctx.req.param(); const currentUrl = `${rootUrl}/2022/ggxw_68627/${caty}/`; const $ = load(await rofetch(currentUrl)); const list = $(".list01-content-containerRight li").slice(0, 20).toArray().map((item) => { const $item = $(item); const a = $item.find("a[href]"); return { title: a.text(), link: new URL(a.attr("href"), currentUrl).href, pubDate: parseDate($item.find("span").text(), "YYYY-MM-DD") }; }); const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { item.description = load(await rofetch(item.link))("div.content_article").html(); return item; }))); return { title: `武汉东湖高新 - ${$("head title").text().trim()}`, link: currentUrl, item: items }; } //#endregion export { route };