UNPKG

rsshub

Version:
68 lines (66 loc) 1.96 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import { t as ViewType } from "./types-gOySfSXJ.mjs"; import "./logger-C4avouvV.mjs"; import { t as ofetch_default } from "./ofetch-DKl_Ma9g.mjs"; import { t as parseDate } from "./parse-date-r5WDWHno.mjs"; import "./is-worker-DESPicPc.mjs"; import { t as cache_default } from "./cache-SV6W5EPy.mjs"; import { t as rss_parser_default } from "./rss-parser-Cnh4NKwh.mjs"; import { load } from "cheerio"; //#region lib/routes/iplaysoft/index.ts const handler = async (ctx) => { const feed = await rss_parser_default.parseURL("https://feed.iplaysoft.com"); const limit = Number.parseInt(ctx.req.query("limit") || "20", 10); const filteredItems = feed.items.filter((item) => { if (!item?.link || !item?.pubDate) return false; return new URL(item.link).hostname.match(/.*\.iplaysoft\.com$/); }).slice(0, limit); return { title: "异次元软件世界", description: "软件改变生活", language: "zh-CN", link: "https://www.iplaysoft.com", item: await Promise.all(filteredItems.map((item) => cache_default.tryGet(item.link, async () => { const $ = load(await ofetch_default(item.link)); $(".entry-content").find("div[style*=\"overflow:hidden\"]").remove(); return { title: item.title, description: $(".entry-content").html(), link: item.link, author: item.author, pubDate: parseDate(item.pubDate) }; }))) }; }; const route = { path: "/", name: "首页", url: "www.iplaysoft.com", maintainers: [ "williamgateszhao", "cscnk52", "LokHsu" ], handler, example: "/iplaysoft", parameters: {}, categories: ["program-update"], features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportRadar: true, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["www.iplaysoft.com"], target: "/" }], view: ViewType.Articles }; //#endregion export { handler, route };