rsshub
Version:
Make RSS Great Again!
70 lines (68 loc) • 2.09 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 { load } from "cheerio";
//#region lib/routes/swjtu/jtys/yjs.ts
const rootURL = "https://ctt.swjtu.edu.cn";
const url_addr = `${rootURL}/yethan/WebIndexAction?setAction=newsList&bigTypeId=0E4BF4D36E232918`;
const getItem = (item, cache) => {
const news_info = item.find("div[class=\"news-title newsInfo\"]");
const news_month = item.find(".month").text();
const news_day = item.find(".day").text();
const info_id = news_info.attr("newsid");
const info_title = news_info.text();
const link = `${rootURL}/yethan/WebIndexAction?setAction=newsInfo&newsId=${info_id}`;
return cache.tryGet(link, async () => {
const info_text = load((await got_default({
method: "get",
url: link
})).data)(".news-left").html();
return {
title: info_title,
pubDate: parseDate(`${news_month}.${news_day}`),
link,
description: info_text
};
});
};
const route = {
path: "/jtys/yjs",
categories: ["university"],
example: "/swjtu/jtys/yjs",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: true,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
name: "交通运输与物流学院",
maintainers: ["qizidog"],
handler,
description: `#### 研究生通知 {#xi-nan-jiao-tong-da-xue-jiao-tong-yun-shu-yu-wu-liu-xue-yuan-yan-jiu-sheng-tong-zhi}`
};
async function handler() {
const $ = load((await got_default({
method: "get",
url: url_addr
})).data);
const list = $("[class='news-list flex']");
return {
title: "西南交大交运学院-研究生通知",
link: url_addr,
item: await Promise.all(list.toArray().map((i) => {
return getItem($(i), cache_default);
})),
allowEmpty: true
};
}
//#endregion
export { route };