From f0acd89d87e5e62c12e20a95225ca9261fefe411 Mon Sep 17 00:00:00 2001 From: Ritesh Ghosh Date: Wed, 25 Dec 2024 18:13:47 +0530 Subject: feat(`/qtip`): add new `/qtip` endpoint --- src/routes/hianime.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/routes/hianime.ts b/src/routes/hianime.ts index 04be1bb..7aab3ff 100644 --- a/src/routes/hianime.ts +++ b/src/routes/hianime.ts @@ -41,6 +41,20 @@ hianimeRouter.get("/azlist/:sortOption", async (c) => { return c.json({ success: true, data }, { status: 200 }); }); +// /api/v2/hianime/qtip/{animeId} +hianimeRouter.get("/qtip/:animeId", async (c) => { + const cacheConfig = c.get("CACHE_CONFIG"); + const animeId = decodeURIComponent(c.req.param("animeId").trim()); + + const data = await cache.getOrSet( + async () => hianime.getQtipInfo(animeId), + cacheConfig.key, + cacheConfig.duration + ); + + return c.json({ success: true, data }, { status: 200 }); +}); + // /api/v2/hianime/category/{name}?page={page} hianimeRouter.get("/category/:name", async (c) => { const cacheConfig = c.get("CACHE_CONFIG"); -- cgit v1.2.3