UNPKG

rsshub

Version:
59 lines (57 loc) 1.83 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import { t as timezone } from "./timezone-D8cuwzTY.mjs"; import { n as finishArticleItem } from "./wechat-mp-Dq_pp853.mjs"; import { load } from "cheerio"; //#region lib/routes/sjtu/seiee/icisee.ts const route = { path: "/seiee/icisee/:cat", categories: ["university"], example: "/sjtu/seiee/icisee/news", parameters: { cat: "子类别" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: true, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [], name: "集成电路学院(信息与电子工程学院)", maintainers: ["dzx-dzx"], handler }; async function handler(ctx) { const currentUrl = `https://icisee.sjtu.edu.cn//${ctx.req.param("cat")}.html`; const $ = load(await ofetch_default(currentUrl)); const list = $(".djdt li").toArray().map((item) => { item = $(item); return { title: item.find(".tit").text().trim(), link: item.find("a").attr("href"), pubDate: timezone(parseDate(item.find(".time").text().trim())) }; }); const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const detailResponse = await ofetch_default.raw(item.link); if (new URL(detailResponse.url).hostname !== "mp.weixin.qq.com") return { ...item, description: $(detailResponse._data).find(".xwxq").html() }; item.link = detailResponse.url; return await finishArticleItem(item); }))); return { title: $("title").text(), link: currentUrl, item: items }; } //#endregion export { route };