rsshub
Version:
Make RSS Great Again!
73 lines (70 loc) • 2.19 kB
JavaScript
import "./esm-shims-CzJ_djXG.mjs";
import "./config-C37vj7VH.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 "./cache-Bo__VnGm.mjs";
import "./render-BQo6B4tL.mjs";
import { n as getData, t as getBuildId } from "./utils-DF3hXsqD.mjs";
//#region lib/routes/aeon/type.ts
const route = {
path: "/:type",
categories: ["new-media"],
example: "/aeon/essays",
parameters: { type: {
description: "Type",
options: [
{
value: "essays",
label: "Essays"
},
{
value: "videos",
label: "Videos"
},
{
value: "audio",
label: "Audio"
}
]
} },
features: {
requireConfig: false,
requirePuppeteer: false,
antiCrawler: false,
supportBT: false,
supportPodcast: false,
supportScihub: false
},
radar: [{ source: ["aeon.co/:type"] }],
name: "Types",
maintainers: ["emdoe"],
handler,
description: `Supported types: Essays, Videos, and Audio.
Compared to the official one, the RSS feed generated by RSSHub not only has more fine-grained options, but also eliminates pull quotes, which can't be easily distinguished from other paragraphs by any RSS reader, but only disrupt the reading flow. This feed also provides users with a bio of the author at the top.`
};
async function handler(ctx) {
const type = ctx.req.param("type");
const capitalizedType = type.charAt(0).toUpperCase() + type.slice(1);
const buildId = await getBuildId();
const url = `https://aeon.co/${type}`;
const items = await getData((await ofetch_default(`https://aeon.co/_next/data/${buildId}/${type}.json`)).pageProps.articles.map((node) => ({
title: node.title,
description: node.standfirstLong,
author: node.authors.map((author) => author.displayName).join(", "),
link: `https://aeon.co/${node.type}s/${node.slug}`,
pubDate: parseDate(node.createdAt),
category: [node.section.title, ...node.topics.map((topic) => topic.title)],
image: node.image.url,
type: node.type,
slug: node.slug
})));
return {
title: `AEON | ${capitalizedType}`,
link: url,
item: items
};
}
//#endregion
export { route };