rsshub
Version:
Make RSS Great Again!
68 lines (66 loc) • 1.96 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import { t as ViewType } from "./types-D84BRIt4.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import { t as ofetch_default } from "./ofetch-BIyrKU3Y.mjs";
import { t as parseDate } from "./parse-date-BrP7mxXf.mjs";
import { t as cache_default } from "./cache-Bo__VnGm.mjs";
import { t as rss_parser_default } from "./rss-parser-Dtop7M8f.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 };