aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRitesh Ghosh <[email protected]>2024-12-25 18:13:47 +0530
committerRitesh Ghosh <[email protected]>2024-12-25 18:13:47 +0530
commitf0acd89d87e5e62c12e20a95225ca9261fefe411 (patch)
tree28c9900f2a2bec4c33dd7fab349eb3d482dcf194 /src
parentc4d4c1edb174deec88d730f811df3607ff753908 (diff)
downloadaniwatch-api-f0acd89d87e5e62c12e20a95225ca9261fefe411.tar.xz
aniwatch-api-f0acd89d87e5e62c12e20a95225ca9261fefe411.zip
feat(`/qtip`): add new `/qtip` endpoint
Diffstat (limited to 'src')
-rw-r--r--src/routes/hianime.ts14
1 files changed, 14 insertions, 0 deletions
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<HiAnime.ScrapedAnimeQtipInfo>(
+ 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");