UNPKG

rsshub

Version:
60 lines (59 loc) 1.96 kB
import { t as parseDate } from "./parse-date-Cr0wQjV_.mjs"; import { t as cache_default } from "./cache-BkqOokyU.mjs"; import { t as got_default } from "./got-BTowW50G.mjs"; import { t as timezone } from "./timezone-BBvDwS_3.mjs"; import { load } from "cheerio"; //#region lib/routes/qdu/houqin.ts const base = "https://houqin.qdu.edu.cn/"; const route = { path: "/houqin", categories: ["university"], example: "/qdu/houqin", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["houqin.qdu.edu.cn/tzgg.htm", "houqin.qdu.edu.cn/"] }], name: "后勤管理处通知", maintainers: ["abc1763613206"], handler, url: "houqin.qdu.edu.cn/tzgg.htm" }; async function handler() { const $ = load((await got_default({ method: "get", url: `${base}index/tzgg.htm` })).data); const list = $(".n_newslist").children(); const items = await Promise.all(list.map((i, item) => { const $item = $(item); const itemTitle = $item.find("a").text(); let itemDate = timezone(parseDate($item.find("span").text()), 8); const path = $item.find("a").attr("href"); const itemUrl = base + path; return cache_default.tryGet(itemUrl, async () => { const $ = load((await got_default(itemUrl)).data); if ($(".article_body").find("div > h4").text().match(/发布时间:(.*)编辑:/) !== null) itemDate = timezone(parseDate($(".article_body").find("div > h4").text().match(/发布时间:(.*)编辑:/)[1].trim(), "YYYY年MM月DD日 HH:mm"), 8); const description = $(".v_news_content").html()?.trim(); return { title: itemTitle, link: itemUrl, pubDate: itemDate, description }; }); })); return { title: "青岛大学 - 后勤管理处通知", link: `${base}index/tzgg.htm`, description: "青岛大学 - 后勤管理处通知", item: items }; } //#endregion export { route };