UNPKG

rsshub

Version:
44 lines (43 loc) 1.68 kB
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 { 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 response = await rofetch(currentUrl); const $ = load(response); 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 () => { const detailResponse = await rofetch(item.link); item.description = load(detailResponse)(".release-notes-content__intro .content").html(); return item; }))); return { title: $("head title").text(), link: currentUrl, item: items }; } //#endregion export { route };