rsshub
Version:
Make RSS Great Again!
44 lines (42 loc) • 1.12 kB
JavaScript
import "./dist-Bog6z_OM.mjs";
import "./config-MQ-7ebJ_.mjs";
import "./logger-C4avouvV.mjs";
import "./ofetch-DKl_Ma9g.mjs";
import { t as parseDate } from "./parse-date-r5WDWHno.mjs";
import "./helpers-Bo4JQYdN.mjs";
import { t as got_default } from "./got-CO-ndVl2.mjs";
import { load } from "cheerio";
//#region lib/routes/gov/gz/index.ts
const rootUrl = "https://www.gz.gov.cn";
const urlMap = {
gzyw: "gzyw",
jrtt: "jrtt",
tzgg: "tzgg",
zcjd: "zcjd/zcjd"
};
const route = {
path: "/gz/:channel/:category",
name: "Unknown",
maintainers: [],
handler
};
async function handler(ctx) {
const url = `${rootUrl}/${ctx.req.param("channel")}/${urlMap[ctx.req.param("category")]}/`;
const $ = load((await got_default(url)).data);
const items = $(".news_list li").toArray().map((item) => {
item = $(item);
const href = item.find("a").attr("href");
return {
title: item.find("a").attr("title"),
link: href,
pubDate: parseDate(item.find("span").text())
};
});
return {
title: `广州市人民政府 - ${$(".main_title").text()}`,
link: url,
item: items
};
}
//#endregion
export { route };