rsshub
Version:
Make RSS Great Again!
92 lines (89 loc) • 3.03 kB
JavaScript
import { n as init_esm_shims, t as __dirname } from "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.mjs";
import "./dist-BInvbO1W.mjs";
import "./logger-Czu8UMNd.mjs";
import "./ofetch-BIyrKU3Y.mjs";
import "./helpers-DxBp0Pty.mjs";
import { t as art } from "./render-BQo6B4tL.mjs";
import { t as got_default } from "./got-KxxWdaxq.mjs";
import path from "node:path";
import { load } from "cheerio";
//#region lib/routes/mindmeister/example.ts
init_esm_shims();
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) => {
item = $(item);
const imageUrl = new URL(item.find(".map-wrapper").attr("style").match(/url\('(.*)'\);/)[1]).href;
return {
title: item.find(".title").text(),
description: art(path.join(__dirname, "templates/image-e463f33f.art"), {
src: imageUrl.split("?")[0],
alt: item.find(".title").text().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 };