UNPKG

rsshub

Version:
42 lines (41 loc) 1.61 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as parseDate } from "./parse-date-CjhZE69i.mjs"; import { t as cache_default } from "./cache-CiDoUSLo.mjs"; import { load } from "cheerio"; //#region lib/routes/qnap/release-notes.ts const route = { path: "/release-notes/:id", categories: ["program-update"], example: "/qnap/release-notes/qts", parameters: { id: "OS id, see below" }, name: "Release Notes", maintainers: ["nczitzk"], description: `| QTS | QuTS hero | QuTScloud | QSS | QuWAN Orchestrator | QES | QVP | QuRouter | TAS | AfoBot | | --- | ---------- | --------- | --- | ------------------- | --- | --- | -------- | --- | ------ | | qts | quts\\_hero | qutscloud | qss | quwan\\_orchestrator | qes | qvp | qurouter | tas | afobot |`, handler }; async function handler(ctx) { const { id } = ctx.req.param(); const currentUrl = `https://www.qnap.com/en/release-notes/${id}`; const $ = load(await rofetch(currentUrl)); const list = $(".release-notes-content__versions li").toArray().slice(0, 20).map((item) => { const $item = $(item); return { title: $item.find(".version-title h4").text().trim(), link: $item.find(".version-btn-container a").attr("href"), pubDate: parseDate($item.find(".release-note-time").text()) }; }); const items = await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { item.description = load(await rofetch(item.link))(".release-notes-content__intro .content").html(); return item; }))); return { title: $("head title").text(), link: currentUrl, item: items }; } //#endregion export { route };