UNPKG

rsshub

Version:
42 lines (41 loc) 1.2 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as parseDate } from "./parse-date-CjhZE69i.mjs"; import { load } from "cheerio"; //#region lib/routes/sketch/updates.ts const route = { path: "/updates", categories: ["program-update"], example: "/sketch/updates", radar: [{ source: ["www.sketch.com/changelog"], target: "/updates" }], name: "Release update", maintainers: ["Jeason0228"], handler, url: "www.sketch.com/changelog" }; async function handler() { const link = "https://www.sketch.com/changelog/"; const $ = load(await rofetch(link)); const items = $("article.detail").toArray().map((item) => { const $item = $(item); const content = $item.find(".detail__content"); content.find("button").remove(); return { title: $item.find("h2.detail__title").text(), description: content.html(), link: $item.find(".detail__date button").attr("data-update-url"), pubDate: parseDate($item.find(".detail__date").attr("datetime")), category: $item.find(".detail__apps .pill").toArray().map((pill) => $(pill).text().trim()) }; }); return { title: $("head title").text(), link, language: "en", item: items }; } //#endregion export { route };