UNPKG

rsshub

Version:
85 lines (83 loc) 2.79 kB
import { t as got_default } from "./got-BTowW50G.mjs"; import { jsx } from "hono/jsx/jsx-runtime"; import { load } from "cheerio"; import { renderToString } from "hono/jsx/dom/server"; //#region lib/routes/mindmeister/example.tsx const baseUrl = "https://www.mindmeister.com"; const route = { path: "/:category?/:language?", categories: ["study"], example: "/mindmeister/mind-map-examples", parameters: { category: "Categories, see the table below, `mind-map-examples` by default", language: "Languages, see the table below, `en` by default" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "Public Maps", maintainers: ["TonyRL"], handler, description: `| Categories | parameter | | ------------- | ----------------- | | Featured Map | mind-map-examples | | Business | business | | Design | design | | Education | education | | Entertainment | entertainment | | Life | life | | Marketing | marketing | | Productivity | productivity | | Summaries | summaries | | Technology | technology | | Other | other | | Languages | parameter | | ---------- | --------- | | English | en | | Deutsch | de | | Français | fr | | Español | es | | Português | pt | | Nederlands | nl | | Dansk | da | | Русский | ru | | 日本語 | ja | | Italiano | it | | 简体中文 | zh | | 한국어 | ko | | Other | other |` }; async function handler(ctx) { const { category = "mind-map-examples", language = "en" } = ctx.req.param(); const link = `${baseUrl}${language === "en" || language === "other" ? "" : `/${language}`}/${category === "mind-map-examples" ? category : `mind-maps/${category}?language=${language}`}`; const $ = load((await got_default(link)).data); const items = $("#public-listing .map-tile-wrapper").toArray().map((item) => { const $item = $(item); const imageUrl = new URL($item.find(".map-wrapper").attr("style").match(/url\('(.*)'\);/)[1]).href; const title = $item.find(".title").text(); return { title, description: renderToString(/* @__PURE__ */ jsx("img", { src: imageUrl.split("?", 1)[0], alt: title.trim() })), link: $item.find(".title").attr("href"), author: $item.find(".author").text().trim().replace(/^by/, ""), category: $item.find(".fw-bold").text() }; }); return { title: $("head title").text(), description: $("head meta[name=description]").text(), link, item: items, language }; } //#endregion export { route };