UNPKG

rsshub

Version:
49 lines (47 loc) 1.74 kB
import "./dist-Bog6z_OM.mjs"; import "./config-MQ-7ebJ_.mjs"; import "./logger-C4avouvV.mjs"; import { t as ofetch_default } from "./ofetch-DKl_Ma9g.mjs"; import { t as parseDate } from "./parse-date-r5WDWHno.mjs"; import "./is-worker-DESPicPc.mjs"; import { t as cache_default } from "./cache-SV6W5EPy.mjs"; import { t as timezone } from "./timezone-CA9Huotp.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) { let response = await ofetch_default(`https://i.qingting.fm/capi/v3/channel/${ctx.req.param("id")}`); const title = response.data.title; response = await ofetch_default(`https://i.qingting.fm/capi/channel/${ctx.req.param("id")}/programs/${response.data.v}?curpage=1&order=asc`); 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 ofetch_default(item.link); item.description = JSON.parse(response.match(/},"program":(.*?),"plist":/)[1]).richtext; return item; }))) }; } //#endregion export { route };