UNPKG

rsshub

Version:
59 lines (57 loc) 1.65 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 { load } from "cheerio"; //#region lib/routes/swjtu/sports.ts const rootURL = "https://sports.swjtu.edu.cn"; const pageURL = `${rootURL}/xwzx.htm`; const route = { path: "/sports", categories: ["university"], example: "/swjtu/sports", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: true, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["sports.swjtu.edu.cn/"] }], name: "体育学院", description: "新闻资讯", maintainers: ["AzureG03"], handler }; const getItem = (item, cache) => { const title = item.find("p.toe").text(); const link = `${rootURL}/${item.find("a").attr("href")}`; return cache.tryGet(link, async () => { const $ = load(await ofetch_default(link)); return { title, pubDate: parseDate($("div.info span:nth-of-type(3)").text().slice(3).match(/\d{4}(-|\/|.)\d{1,2}\1\d{1,2}/)?.[0]), link, description: $("div.detail-wrap").html() }; }); }; async function handler() { const $ = load(await ofetch_default(pageURL)); const $list = $("div.news-list > ul > li"); return { title: "西南交大体院-新闻资讯", link: pageURL, item: await Promise.all($list.toArray().map((i) => { return getItem($(i), cache_default); })), allowEmpty: true }; } //#endregion export { route };