Aniwatch API Version 2 (#66)

BREAKING CHANGE:

* chore: remove files that are not necessary for api v2

* test: update existing tests to use  pkg

* feat: organized aniwatch api envs and add more info about them

* feat: update tsconfig to include strict noUnsed params

* feat(api homepage): revamp api home page

* feat: update wani kuni image

* feat: add dot img

* feat: use hono cors

* feat: use hono rate limiter

* build: remove unnecessary deps, add ones needed and update description

* feat: add hianime routes and their handlers

* feat: update vercel deployment file

* docs: update logo and scraper docs, add envs section

* feat: update main server file

* feat: update peronal deployments caution section
This commit is contained in:
Ritesh Ghosh
2024-10-06 01:13:23 +05:30
committed by GitHub
parent 55810ccf23
commit 46f688ac12
84 changed files with 1028 additions and 3893 deletions
+11 -9
View File
@@ -1,15 +1,17 @@
import { expect, test } from "vitest";
import { scrapeEstimatedSchedule } from "../src/parsers/index.js";
import { HiAnime } from "aniwatch";
function padZero(num: number) {
return num < 10 ? `0${num}` : num.toString();
}
const padZero = (num: number) => (num < 10 ? `0${num}` : num.toString());
test("returns estimated schedule anime release", async () => {
const d = new Date();
const data = await scrapeEstimatedSchedule(
`${d.getFullYear()}-${padZero(d.getMonth() + 1)}-${padZero(d.getDate())}`
);
const d = new Date();
const date = `${d.getFullYear()}-${padZero(d.getMonth() + 1)}-${padZero(
d.getDate()
)}`;
// npx vitest run estimatedSchedule.test.ts
test(`GET /api/v2/hianime/schedule?date=${date}`, async () => {
const hianime = new HiAnime.Scraper();
const data = await hianime.getEstimatedSchedule(date);
expect(data.scheduledAnimes).not.toEqual([]);
});