UNPKG

rsshub

Version:
65 lines (63 loc) 2.21 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"; import iconv from "iconv-lite"; //#region lib/routes/stbu/jsjxy.ts const gbk2utf8 = (s) => iconv.decode(s, "gbk"); const route = { path: "/jsjxy", categories: ["university"], example: "/stbu/jsjxy", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: true, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["jsjxy.stbu.edu.cn/news", "jsjxy.stbu.edu.cn"] }, { source: ["stbu.edu.cn"] }], name: "计算机学院 - 通知公告", maintainers: ["HyperCherry"], handler, url: "jsjxy.stbu.edu.cn/news", description: `::: warning 计算机学院通知公告疑似禁止了非大陆 IP 访问,使用路由需要自行 [部署](https://docs.rsshub.app/deploy/)。 :::` }; async function handler() { const baseUrl = "https://jsjxy.stbu.edu.cn/news/"; const { data: response } = await got_default(baseUrl, { responseType: "buffer" }); const $ = load(gbk2utf8(response)); const list = $(".content dl h4").toArray().map((item) => { item = $(item); const a = item.find("a").first(); return { title: a.text(), link: a.attr("href") }; }); return { title: "四川工商学院计算机学院 - 新闻动态", link: baseUrl, description: "四川工商学院计算机学院 - 新闻动态", item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const { data: response } = await got_default(item.link, { responseType: "buffer" }); const $ = load(gbk2utf8(response)); item.description = $(".content14").first().html().trim(); item.pubDate = timezone(parseDate($(".article .source").text().split("日期:")[1].replace("\n", "").trim()), 8); return item; }))) }; } //#endregion export { route };