UNPKG

rsshub

Version:
53 lines (51 loc) 1.6 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import { t as ViewType } from "./types-D84BRIt4.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import "./helpers-DxBp0Pty.mjs"; import { t as got_default } from "./got-KxxWdaxq.mjs"; //#region lib/routes/gamer/ani/anime.ts const route = { path: "/ani/anime/:sn", categories: ["anime"], view: ViewType.Videos, example: "/gamer/ani/anime/36868", parameters: { sn: "動畫 sn,在 URL 可以找到" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, radar: [{ source: ["ani.gamer.com.tw/"], target: "/anime/:sn" }], name: "動畫瘋 - 動畫", maintainers: ["maple3142", "pseudoyu"], handler }; async function handler(ctx) { const { sn } = ctx.req.param(); const { data: response } = await got_default("https://api.gamer.com.tw/mobile_app/anime/v3/video.php", { searchParams: { sn } }); if (response.error) throw new Error(response.error.message); const anime = response.data.anime; const title = anime.title.replaceAll(/\[\d+?]$/g, "").trim(); const items = anime.volumes[0].map((item) => ({ title: `${title}${item.volume} 集`, description: `<img src="${item.cover}">`, link: `https://ani.gamer.com.tw/animeVideo.php?sn=${item.video_sn}` })).toReversed(); return { title, link: `https://ani.gamer.com.tw/animeRef.php?sn=${anime.anime_sn}`, description: anime.content?.trim(), item: items }; } //#endregion export { route };