UNPKG

rsshub

Version:
38 lines (37 loc) 1.24 kB
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs"; import { t as parseDate } from "./parse-date-3kcy2Eau.mjs"; import { t as timezone } from "./timezone-UiMFOuvL.mjs"; import { load } from "cheerio"; //#region lib/routes/qq/weixin/miniprogram/framework.ts const route = { path: "/weixin/miniprogram/framework", categories: ["programming"], example: "/qq/weixin/miniprogram/framework", name: "基础库更新日志", maintainers: ["magicLaLa", "nczitzk"], handler }; async function handler() { const link = "https://developers.weixin.qq.com/miniprogram/dev/framework/release/"; const response = await rofetch(link); const $ = load(response); const name = $("#docContent .content h1").text().replaceAll(/[\s#|]/g, ""); return { title: name, link, item: $("#docContent .content h2").toArray().map((item) => { const $item = $(item); const title = $item.text().replaceAll(/[\s#|]/g, ""); const date = /\d{4}[.-]\d{2}[.-]\d{2}/.exec(title)?.[0]; return { title, description: $item.next().html(), pubDate: date ? timezone(parseDate(date.replaceAll(".", "-")), 8) : void 0, link: link + $item.find("a.header-anchor").attr("href") }; }), description: name }; } //#endregion export { route };