UNPKG

rsshub

Version:
40 lines (39 loc) 1.11 kB
import { t as cache_default } from "./cache-CiDoUSLo.mjs"; import { n as parseContent, t as cnuFetch } from "./utils-6zKP85u_.mjs"; //#region lib/routes/cnu.cc/selected.ts const route = { path: "/selected", categories: ["picture"], example: "/cnu.cc/selected", name: "每日精选", maintainers: ["hoilc"], handler }; async function handler() { const listResponse = await cnuFetch("http://www.cnu.cc/selectedsFlow/1"); const list = JSON.parse(listResponse).data.flatMap((day) => day.works.map((work) => ({ title: work.title, link: `http://www.cnu.cc/works/${work.id}` }))); return { title: "CNU视觉联盟 - 每日精选", link: "http://www.cnu.cc/selectedPage", item: (await Promise.all(list.map((item) => cache_default.tryGet(item.link, async () => { let result; try { result = parseContent(await cnuFetch(item.link)); } catch { return ""; } if (!result.description) return ""; return { ...item, author: result.author, description: result.description, pubDate: result.pubDate }; })))).filter(Boolean) }; } //#endregion export { route };