rsshub
Version:
Make RSS Great Again!
50 lines (49 loc) • 1.47 kB
JavaScript
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs";
import { t as parseDate } from "./parse-date-3kcy2Eau.mjs";
import { t as cache_default } from "./cache-C1Y-9qDV.mjs";
import { t as timezone } from "./timezone-UiMFOuvL.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 response = await rofetch(baseUrl);
const $ = load(response);
const list = $(".contents .news_wrap").toArray().map((item) => {
const title = $(item).find(".news_title").text();
const link = new URL($(item).find("a").attr("href"), baseUrl).href;
const date = $(item).find("time").text();
return {
title,
link,
pubDate: timezone(parseDate(date), 9),
description: ""
};
});
return {
title: "LastOrigin官网公告",
link: baseUrl,
item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => {
const response = await rofetch(item.link);
item.description = load(response)(".news_contents_editor").html() ?? "";
return item;
})))
};
}
//#endregion
export { route };