UNPKG

rsshub

Version:
62 lines (61 loc) 1.55 kB
import { t as rofetch } from "./ofetch-C3ts-Hud.mjs"; import { t as cache_default } from "./cache-BkqOokyU.mjs"; import { t as parser } from "./rss-parser-CmTb9lkc.mjs"; import { load } from "cheerio"; //#region lib/routes/jandan/index.ts const route = { path: "/", example: "/jandan", name: "Feed", maintainers: [ "lonelykid", "nczitzk", "bigfei", "pseudoyu" ], parameters: {}, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["i.jandan.net"], target: "/jandan" }], handler }; async function handler() { const rootUrl = "https://i.jandan.net"; const feed = await parser.parseURL(`${rootUrl}/feed/`); return { title: "煎蛋", link: rootUrl, item: (await Promise.all(feed.items.map((item) => { const link = item.link; if (!link) return; return cache_default.tryGet(link, async () => { const $ = load(await rofetch(link)); $(".wechat-hide").prev().nextAll().remove(); $("img").replaceWith((i, e) => { const src = $(e).attr("src"); const alt = $(e).attr("alt"); return `<img src="${src?.replace(/https?:\/\/(\w+)\.moyu\.im/, "https://$1.sinaimg.cn")}" alt="${alt}">`; }); return { title: item.title || "", description: $(".entry").html(), pubDate: item.pubDate, link: item.link, author: item["dc:creator"], category: item.categories }; }); }))).filter((item) => item !== void 0) }; } //#endregion export { route };