rsshub
Version:
Make RSS Great Again!
51 lines (49 loc) • 1.52 kB
JavaScript
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 { t as timezone } from "./timezone-D8cuwzTY.mjs";
import { load } from "cheerio";
//#region lib/routes/j-test/news.ts
const route = {
path: "/news",
name: "公告",
url: "www.j-test.com",
maintainers: ["kuhahku"],
example: "/j-test/news",
parameters: {},
categories: ["study"],
features: { supportRadar: true },
radar: [{
source: ["www.j-test.com"],
target: "/news"
}],
handler,
description: ""
};
async function handler() {
const baseUrl = "http://www.j-test.com";
const $ = load(await ofetch_default(baseUrl));
const list = $("#content1 > .center > .col_box1 > .col_body1 > ul > li").toArray().map((item) => {
const [title, date] = $(item).text().trim().replaceAll("]", "").split(" [");
return {
title,
link: new URL($(item).children("a").attr("href"), baseUrl).href,
pubDate: timezone(parseDate(date), 8),
description: ""
};
});
return {
title: "实用日本语鉴定考试(J.TEST)公告",
link: baseUrl,
item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
item.description = load(await ofetch_default(item.link))(".content > table").html() ?? "";
return item;
})))
};
}
//#endregion
export { route };