UNPKG

rsshub

Version:
60 lines (58 loc) 1.79 kB
import "./esm-shims-CzJ_djXG.mjs"; import { t as config } from "./config-C37vj7VH.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import { t as parseDate } from "./parse-date-BrP7mxXf.mjs"; import { t as cache_default } from "./cache-Bo__VnGm.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; import { load } from "cheerio"; //#region lib/routes/qbittorrent/news.ts const route = { path: "/news", categories: ["program-update"], example: "/qbittorrent/news", parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["qbittorrent.org/news.php", "qbittorrent.org/"] }], name: "News", maintainers: ["TonyRL"], handler, url: "qbittorrent.org/news.php" }; async function handler(ctx) { const baseUrl = "https://www.qbittorrent.org"; const $ = load(await cache_default.tryGet(`${baseUrl}/news.php`, async () => (await got_default(`${baseUrl}/news.php`, { headers: { Referer: baseUrl } })).data, config.cache.routeExpire, false)); const item = $(".stretcher").find("h3").toArray().map((item$1) => { item$1 = $(item$1); const pubDate = item$1.text().split(" - ")[0].replace(/\w{3,6}day/, ""); const title = item$1.text().split(" - ")[1]; let description = ""; while (item$1.next().length && item$1.next().get(0).tagName !== "h3") { item$1 = item$1.next(); description += item$1.html(); } return { title, description, pubDate: parseDate(pubDate, "MMMM D YYYY") }; }); const ret = { title: "qBittorrent News", link: `${baseUrl}/news.php`, item }; ctx.set("json", ret); return ret; } //#endregion export { route };