UNPKG

rsshub

Version:
56 lines (54 loc) 1.74 kB
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 "./is-worker-DESPicPc.mjs"; import { t as cache_default } from "./cache-SV6W5EPy.mjs"; import "./helpers-Bo4JQYdN.mjs"; import { t as got_default } from "./got-CO-ndVl2.mjs"; import { t as timezone } from "./timezone-CA9Huotp.mjs"; import { load } from "cheerio"; //#region lib/routes/jseea/news.ts const baseUrl = "https://www.jseea.cn"; const siteTitle = " - 江苏省教育考试院"; async function loadContent(link) { const { data: response } = await got_default(link); const $ = load(response); $("strong").remove(); return $("#content").html(); } const route = { path: "/news/:type?", radar: [{ source: ["jseea.cn/webfile/news/:type"], target: "/news/:type" }], name: "Unknown", maintainers: ["schen1024"], handler }; async function handler(ctx) { const listPageUrl = `${baseUrl}/webfile/news/${ctx.req.param("type") ?? "zkyw"}/`; const { data: response } = await got_default(listPageUrl); const $ = load(response); const list = $("div.content-list-div ul li a").toArray().map((item) => { item = $(item); return { title: item.contents().filter((_, e) => e.nodeType === 3).text().trim(), link: `https:${item.attr("href")}`, pubDate: timezone(parseDate(item.find("span").text(), "YYYY-MM-DD"), 8) }; }); const result = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { item.description = await loadContent(item.link); return item; }))); return { title: $("head title").text() + siteTitle, link: listPageUrl, item: result }; } //#endregion export { route };