rsshub
Version:
Make RSS Great Again!
69 lines (67 loc) • 2.14 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import { t as parseDate } from "./parse-date-BrP7mxXf.mjs";
import { t as cache_default } from "./cache-Bo__VnGm.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import { t as timezone } from "./timezone-D8cuwzTY.mjs";
import { load } from "cheerio";
import iconv from "iconv-lite";
//#region lib/routes/stbu/xyxw.ts
const gbk2utf8 = (s) => iconv.decode(s, "gbk");
const route = {
path: "/xyxw",
categories: ["university"],
example: "/stbu/xyxw",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["stbu.edu.cn/html/news/xueyuan", "stbu.edu.cn"] }],
name: "学院新闻",
maintainers: ["HyperCherry"],
handler,
url: "stbu.edu.cn/html/news/xueyuan"
};
async function handler() {
const baseUrl = "http://www.stbu.edu.cn";
const requestUrl = `${baseUrl}/html/news/xueyuan/`;
const { data: response } = await got_default(requestUrl, {
responseType: "buffer",
https: { rejectUnauthorized: false }
});
const $ = load(gbk2utf8(response));
const list = $(".style_2 .Simple_title").toArray().map((item) => {
item = $(item);
const a = item.find("a").first();
return {
title: a.text(),
link: `${baseUrl}${a.attr("href")}`
};
});
return {
title: "四川工商学院 - 学院新闻",
link: requestUrl,
description: "四川工商学院 - 学院新闻",
item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
const { data: response$1 } = await got_default(item.link, {
responseType: "buffer",
https: { rejectUnauthorized: false }
});
const $$1 = load(gbk2utf8(response$1));
item.description = $$1(".artmainl .articlemain").first().html();
item.pubDate = timezone(parseDate($$1(".artmainl .info").text().split("|")[2].split(":")[1].trim()), 8);
return item;
})))
};
}
//#endregion
export { route };