rsshub
Version:
Make RSS Great Again!
64 lines (62 loc) • 2.15 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 * as cheerio from "cheerio";
//#region lib/routes/cas/mesalab/kb.ts
const route = {
path: "/mesalab/kb",
categories: ["university"],
example: "/cas/mesalab/kb",
parameters: {},
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["www.mesalab.cn/f/article/articleList", "www.mesalab.cn/"] }],
name: "信息工程研究所 第二研究室 处理架构组 知识库",
maintainers: ["renzhexigua"],
handler,
url: "www.mesalab.cn/f/article/articleList"
};
async function handler() {
const homepage = "https://www.mesalab.cn";
const url = `${homepage}/f/article/articleList?pageNo=1&pageSize=15&createTimeSort=DESC`;
const response = await got_default(url);
const $ = cheerio.load(response.data);
const articles = $(".aw-item").toArray();
return {
title: "MESA 知识库",
description: "中国科学院信息工程研究所 第二研究室 处理架构组",
link: url,
item: await Promise.all(articles.map((item) => {
const a = $(item).find("a").first();
const title = a.text().trim();
const link = `${homepage}${a.attr("href")}`;
return cache_default.tryGet(link, async () => {
const result = await got_default(link);
const $$1 = cheerio.load(result.data);
return {
title,
author: $$1(".user_name").text(),
pubDate: timezone(parseDate($$1(".link_postdate").text().replaceAll(/\s+/g, " ")), 8),
description: $$1("#article_content").html() + ($$1(".attachment").length ? $$1(".attachment").html() : ""),
link,
category: $$1(".category .category_r span").first().text()
};
});
}))
};
}
//#endregion
export { route };