UNPKG

rsshub

Version:
52 lines (50 loc) 1.61 kB
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 { t as cache_default } from "./cache-Bo__VnGm.mjs"; import { t as timezone } from "./timezone-D8cuwzTY.mjs"; import { load } from "cheerio"; //#region lib/routes/miyuki/news.ts const ORIGIN = "https://miyuki.jp"; const NEWS_LINK = `${ORIGIN}/s/y10/news/list`; const route = { path: "/news", example: "/miyuki/news", name: "News", categories: ["new-media"], maintainers: ["KarasuShin"], features: { supportRadar: true }, handler, radar: [{ source: ["miyuki.jp", "miyuki.jp/s/y10/news/list"], target: "/news" }] }; async function handler() { const $ = load(await ofetch_default(NEWS_LINK)); return { title: "中島みゆき Official - News", link: NEWS_LINK, item: await Promise.all($(".list__side_border li").toArray().map(async (item) => { const $item = $(item); const link = `${ORIGIN}${$item.find("a").attr("href")}`; return await cache_default.tryGet(link, async () => { const category = $item.find("p span").last().text(); return { title: `${category} - ${$item.find("a").text()}`, link, pubDate: timezone(parseDate($item.find("p span").first().text()), 9), category: [category], description: await cache_default.tryGet(link, async () => { return load(await ofetch_default(link))(".contents_area__inner").html(); }) }; }); })) }; } //#endregion export { route };