UNPKG

rsshub

Version:
31 lines (30 loc) 1.24 kB
import { t as rofetch } from "./ofetch-W1aeTHCo.mjs"; import { t as parseDate } from "./parse-date-CjhZE69i.mjs"; import { t as cache_default } from "./cache-CiDoUSLo.mjs"; //#region lib/routes/yinxiang/note.ts const route = { path: "/note", categories: ["study"], example: "/yinxiang/note", name: "印象剪藏", maintainers: ["nczitzk"], handler }; async function handler() { const list = (await rofetch("https://app.yinxiang.com/third/discovery/client/restful/public/v2/discovery/homepage?notePageSize=20")).blogNote.slice(0, 5).map((item) => ({ title: item.title, link: `https://www.yinxiang.com/everhub/note/${item.noteGuid}`, pubDate: parseDate(Number(item.publishTime)) })); return { title: "印象剪藏 - 印象识堂", link: "https://www.yinxiang.com/everhub/", item: await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { const description = (await rofetch(`https://app.yinxiang.com/third/discovery/client/restful/public/blog-note?noteGuid=${item.link.split("/note/", 2)[1]}`)).blogNote.htmlContent; item.description = description.includes("<?xml") ? description.match(/<en-note>(.*)<\/en-note>/)[1] : description; return item; }))) }; } //#endregion export { route };