UNPKG

rsshub

Version:
46 lines (45 loc) 1.64 kB
import { t as rofetch } from "./ofetch-U0CdpE2g.mjs"; import { t as parseDate } from "./parse-date-3kcy2Eau.mjs"; import { t as cache_default } from "./cache-C1Y-9qDV.mjs"; import { t as timezone } from "./timezone-UiMFOuvL.mjs"; //#region lib/routes/qingting/channel.ts const route = { path: "/channel/:id", categories: ["multimedia"], example: "/qingting/channel/293411", parameters: { id: "专辑id, 可在专辑页 URL 中找到" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "专辑", maintainers: ["nczitzk", "pseudoyu"], handler }; async function handler(ctx) { const channelUrl = `https://i.qingting.fm/capi/v3/channel/${ctx.req.param("id")}`; let response = await rofetch(channelUrl); const title = response.data.title; const programUrl = `https://i.qingting.fm/capi/channel/${ctx.req.param("id")}/programs/${response.data.v}?curpage=1&order=asc`; response = await rofetch(programUrl); const items = response.data.programs.map((item) => ({ title: item.title, link: `https://www.qingting.fm/channels/${ctx.req.param("id")}/programs/${item.id}/`, pubDate: timezone(parseDate(item.update_time), 8) })); return { title: `${title} - 蜻蜓FM`, link: `https://www.qingting.fm/channels/${ctx.req.param("id")}`, item: await Promise.all(items.map((item) => cache_default.tryGet(item.link, async () => { response = await rofetch(item.link); item.description = JSON.parse(response.match(/\},"program":(.*?),"plist":/)[1]).richtext; return item; }))) }; } //#endregion export { route };