UNPKG

rsshub

Version:
54 lines (52 loc) 1.8 kB
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 { t as parseDate } from "./parse-date-BrP7mxXf.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"; //#region lib/routes/curius/links.ts init_esm_shims(); const route = { path: "/links/:name", categories: ["social-media"], example: "/curius/links/yuu-yuu", parameters: { name: "Username, can be found in URL" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["curius.app/:name"] }], name: "User", maintainers: ["Ovler-Young"], handler }; async function handler(ctx) { const username = ctx.req.param("name"); const data = (await got_default(`https://curius.app/api/users/${username}`, { headers: { Referer: `https://curius.app/${username}` } })).data; const uid = data.user.id; const name = `${data.user.firstName} ${data.user.lastName}`; const items = (await got_default(`https://curius.app/api/users/${uid}/links?page=0`, { headers: { Referer: `https://curius.app/${username}` } })).data.userSaved.map((item) => ({ title: item.title, description: art(path.join(__dirname, "templates/description-8da65e21.art"), { item }), link: item.link, pubDate: parseDate(item.createdDate), guid: `curius:${username}:${item.id}` })); return { title: `${name} - Curius`, link: `https://curius.app/${username}`, description: `${name} - Curius`, allowEmpty: true, item: items }; } //#endregion export { route };