UNPKG

rsshub

Version:
50 lines (48 loc) 1.52 kB
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/last-origin/news.ts const route = { path: "/news", name: "News", url: "www.last-origin.com", maintainers: ["gudezhi"], example: "/last-origin/news", parameters: {}, categories: ["game"], features: { supportRadar: true }, radar: [{ source: ["www.last-origin.com/news.html", "www.last-origin.com"], target: "/news" }], handler, description: "" }; async function handler() { const baseUrl = "https://www.last-origin.com/news.html"; const $ = load(await ofetch_default(baseUrl)); const list = $(".contents .news_wrap").toArray().map((item) => { return { title: $(item).find(".news_title").text().trim(), link: new URL($(item).find("a").attr("href"), baseUrl).href, pubDate: timezone(parseDate($(item).find("time").text().trim()), 9), description: "" }; }); return { title: "LastOrigin官网公告", link: baseUrl, item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { item.description = load(await ofetch_default(item.link))(".news_contents_editor").html() ?? ""; return item; }))) }; } //#endregion export { route };