From 797fc2455c143aaa8e7adb08865277b2c0806341 Mon Sep 17 00:00:00 2001 From: Ritesh Ghosh Date: Sun, 11 May 2025 13:05:23 +0530 Subject: [PATCH] style: prettier format changes --- CHANGELOG.md | 20 +- CONTRIBUTING.md | 34 +-- README.md | 4 +- public/index.html | 451 +++++++++++++++-------------- src/config/variables.ts | 10 +- test/animeAboutInfo.test.ts | 12 +- test/animeCategory.test.ts | 14 +- test/animeEpisodeSrcs.test.ts | 14 +- test/animeEpisodes.test.ts | 8 +- test/animeGenre.test.ts | 10 +- test/animeProducer.test.ts | 14 +- test/animeSearch.test.ts | 10 +- test/animeSearchSuggestion.test.ts | 6 +- test/episodeServers.test.ts | 12 +- test/estimatedSchedule.test.ts | 8 +- test/homePage.test.ts | 28 +- vitest.config.ts | 10 +- 17 files changed, 326 insertions(+), 339 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69b8c40..da6bbb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,35 +1,21 @@ # [2.12.0](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.11.3...v2.12.0) (2025-04-14) - ### Features -* **getNextEpisodeSchedule:** add `/anime/:animeId/next-episode-schedule` endpoint ([f5cd341](https://github.com/ghoshRitesh12/aniwatch-api/commit/f5cd3415d8134da1ab1e3b3f8f9be6b5212aa353)) - - +- **getNextEpisodeSchedule:** add `/anime/:animeId/next-episode-schedule` endpoint ([f5cd341](https://github.com/ghoshRitesh12/aniwatch-api/commit/f5cd3415d8134da1ab1e3b3f8f9be6b5212aa353)) ## [2.11.3](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.11.2...v2.11.3) (2025-03-20) - - ## [2.11.2](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.11.1...v2.11.2) (2025-03-15) - - ## [2.11.1](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.11.0...v2.11.1) (2025-01-01) - ### Bug Fixes -* **ts build error:** fixed ts build error due to conflicting types ([cb5a467](https://github.com/ghoshRitesh12/aniwatch-api/commit/cb5a4672a8c3b0729bbb4522a3af252f7b336b97)) - - +- **ts build error:** fixed ts build error due to conflicting types ([cb5a467](https://github.com/ghoshRitesh12/aniwatch-api/commit/cb5a4672a8c3b0729bbb4522a3af252f7b336b97)) # [2.11.0](https://github.com/ghoshRitesh12/aniwatch-api/compare/v2.10.0...v2.11.0) (2024-12-25) - ### Features -* **`/qtip`:** add new `/qtip` endpoint ([f0acd89](https://github.com/ghoshRitesh12/aniwatch-api/commit/f0acd89d87e5e62c12e20a95225ca9261fefe411)) - - - +- **`/qtip`:** add new `/qtip` endpoint ([f0acd89](https://github.com/ghoshRitesh12/aniwatch-api/commit/f0acd89d87e5e62c12e20a95225ca9261fefe411)) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d470d24..6df0505 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,8 +8,8 @@ Thank you for your interest in contributing to aniwatch-api. We appreciate whate - [Ground Rules & Expectations](#ground-rules--expectations) - [How To Contribute](#how-to-contribute) - [Prerequisites](#prerequisites) - - [Clone the repository](#clone-the-repository) - - [Project Structure](#project-structure) + - [Clone the repository](#clone-the-repository) + - [Project Structure](#project-structure) - [Commit Messages](#commit-messages) ## Types of contributions we are looking for @@ -42,10 +42,10 @@ To contribute to this project, you must know the following: - [NodeJS](https://nodejs.org/) - [TypeScript](https://www.typescriptlang.org/) - Web Scraping - - [Cheerio](https://cheerio.js.org/) - - [Axios](https://axios-http.com/docs/intro) - - [CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) - - [Browser Dev Tools](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Tools_and_setup/What_are_browser_developer_tools) + - [Cheerio](https://cheerio.js.org/) + - [Axios](https://axios-http.com/docs/intro) + - [CSS Selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors) + - [Browser Dev Tools](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Tools_and_setup/What_are_browser_developer_tools) ### Clone the repository @@ -58,9 +58,9 @@ git clone https://github.com//aniwatch-api 3. Creating a new branch
Replace \ with any of the following naming conventions:
- - `feature/` - for adding new features - - `bug/` - for fixing known bugs - - `misc/` - for anything other than bug or features + - `feature/` - for adding new features + - `bug/` - for fixing known bugs + - `misc/` - for anything other than bug or features ```bash git checkout -b @@ -70,14 +70,14 @@ git checkout -b - `src` directory contains all the source code required for this project - - `controllers` directory contains all the controller logic - - `types` directory contains all types & interfaces used for this project - - `parsers` directory contains all the parsing aka scraping logic - - `routes` directory contains all the routers - - `utils` directory contains handy utility methods and properties - - `config` directory contains api configuration related files - - `extractors` directory contains anime streaming url extractor files -

+ - `controllers` directory contains all the controller logic + - `types` directory contains all types & interfaces used for this project + - `parsers` directory contains all the parsing aka scraping logic + - `routes` directory contains all the routers + - `utils` directory contains handy utility methods and properties + - `config` directory contains api configuration related files + - `extractors` directory contains anime streaming url extractor files +

- `test` directory contains all the tests that needs to be evaluated diff --git a/README.md b/README.md index e48a14a..1f16b59 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ #

Aniwatch API

- A free RESTful API serving anime information from hianime.to + A free RESTful API serving anime information from hianimez.to
@@ -56,7 +56,7 @@ > [!IMPORTANT] > > 1. [https://api-aniwatch.onrender.com](https://api-aniwatch.onrender.com/) is only meant to demo the API and has rate-limiting enabled to minimize bandwidth consumption. It is recommended to deploy your own instance for personal use by customizing the API as you need it to be. -> 2. This API is just an unofficial API for [hianime.to](https://hianime.to) and is in no other way officially related to the same. +> 2. This API is just an unofficial API for [hianimez.to](https://hianimez.to) and is in no other way officially related to the same. > 3. The content that this API provides is not mine, nor is it hosted by me. These belong to their respective owners. This API just demonstrates how to build an API that scrapes websites and uses their content. ## Table of Contents diff --git a/public/index.html b/public/index.html index ff7384f..c095416 100644 --- a/public/index.html +++ b/public/index.html @@ -2,276 +2,277 @@ - - Aniwatch API - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - + .api-stats-container a { + flex-shrink: 0; + user-select: none; + } + + .contributors { + margin-top: 1rem; + text-align: center; + } + - - - + + + -
-

- Welcome to the unofficial - hianime.to - API - ⚔️ -

+
+

+ Welcome to the unofficial + hianimez.to + API + ⚔️ +

- + - -
-

Thanks to the following people for keeping this - project alive and - relevant.

+
+

Thanks to the following people for keeping this + project alive and + relevant.

- - Contributors - -
-
+ + Contributors + +
+ \ No newline at end of file diff --git a/src/config/variables.ts b/src/config/variables.ts index b58316f..dc90dcf 100644 --- a/src/config/variables.ts +++ b/src/config/variables.ts @@ -1,8 +1,8 @@ type CacheVariables = { - CACHE_CONFIG: { - key: string; - duration: number; - }; + CACHE_CONFIG: { + key: string; + duration: number; + }; }; -export type AniwatchAPIVariables = {} & CacheVariables; +export type AniwatchAPIVariables = CacheVariables & {}; diff --git a/test/animeAboutInfo.test.ts b/test/animeAboutInfo.test.ts index 82fe97d..8a6ed94 100644 --- a/test/animeAboutInfo.test.ts +++ b/test/animeAboutInfo.test.ts @@ -5,11 +5,11 @@ const animeId = "steinsgate-3"; // npx vitest run animeAboutInfo.test.ts test(`GET /api/v2/hianime/anime/${animeId}`, async () => { - const hianime = new HiAnime.Scraper(); - const data = await hianime.getInfo(animeId); + const hianime = new HiAnime.Scraper(); + const data = await hianime.getInfo(animeId); - expect(data.anime.info.name).not.toEqual(null); - expect(data.recommendedAnimes).not.toEqual([]); - expect(data.mostPopularAnimes).not.toEqual([]); - expect(Object.keys(data.anime.moreInfo)).not.toEqual([]); + expect(data.anime.info.name).not.toEqual(null); + expect(data.recommendedAnimes).not.toEqual([]); + expect(data.mostPopularAnimes).not.toEqual([]); + expect(Object.keys(data.anime.moreInfo)).not.toEqual([]); }); diff --git a/test/animeCategory.test.ts b/test/animeCategory.test.ts index 045b0f9..84d14e0 100644 --- a/test/animeCategory.test.ts +++ b/test/animeCategory.test.ts @@ -5,12 +5,12 @@ const category = "subbed-anime"; // npx vitest run animeCategory.test.ts test(`GET /api/v2/hianime/category/${category}`, async () => { - const hianime = new HiAnime.Scraper(); - const data = await hianime.getCategoryAnime(category); + const hianime = new HiAnime.Scraper(); + const data = await hianime.getCategoryAnime(category); - expect(data.animes).not.toEqual([]); - expect(data.genres).not.toEqual([]); - expect(data.top10Animes.today).not.toEqual([]); - expect(data.top10Animes.week).not.toEqual([]); - expect(data.top10Animes.month).not.toEqual([]); + expect(data.animes).not.toEqual([]); + expect(data.genres).not.toEqual([]); + expect(data.top10Animes.today).not.toEqual([]); + expect(data.top10Animes.week).not.toEqual([]); + expect(data.top10Animes.month).not.toEqual([]); }); diff --git a/test/animeEpisodeSrcs.test.ts b/test/animeEpisodeSrcs.test.ts index d8db0ed..752020c 100644 --- a/test/animeEpisodeSrcs.test.ts +++ b/test/animeEpisodeSrcs.test.ts @@ -7,12 +7,12 @@ const category = "sub"; // npx vitest run animeEpisodeSrcs.test.ts test(`GET /api/v2/hianime/episode/sources?animeEpisodeId=${animeEpisodeId}&server=${server}&category=${category}`, async () => { - const hianime = new HiAnime.Scraper(); - const data = await hianime.getEpisodeSources( - animeEpisodeId, - server, - category - ); + const hianime = new HiAnime.Scraper(); + const data = await hianime.getEpisodeSources( + animeEpisodeId, + server, + category + ); - expect(data.sources).not.toEqual([]); + expect(data.sources).not.toEqual([]); }); diff --git a/test/animeEpisodes.test.ts b/test/animeEpisodes.test.ts index fbe75ae..0762796 100644 --- a/test/animeEpisodes.test.ts +++ b/test/animeEpisodes.test.ts @@ -5,9 +5,9 @@ const animeId = "steinsgate-3"; // npx vitest run animeEpisodes.test.ts test(`GET /api/v2/hianime/anime/${animeId}/episodes`, async () => { - const hianime = new HiAnime.Scraper(); - const data = await hianime.getEpisodes(animeId); + const hianime = new HiAnime.Scraper(); + const data = await hianime.getEpisodes(animeId); - expect(data.totalEpisodes).not.toEqual(0); - expect(data.episodes).not.toEqual([]); + expect(data.totalEpisodes).not.toEqual(0); + expect(data.episodes).not.toEqual([]); }); diff --git a/test/animeGenre.test.ts b/test/animeGenre.test.ts index f08ad1b..f9cfca7 100644 --- a/test/animeGenre.test.ts +++ b/test/animeGenre.test.ts @@ -6,11 +6,11 @@ const page = 2; // npx vitest run animeGenre.test.ts test(`GET /api/v2/hianime/genre/${genreName}?page=${page}`, async () => { - const hianime = new HiAnime.Scraper(); + const hianime = new HiAnime.Scraper(); - const data = await hianime.getGenreAnime(genreName, page); + const data = await hianime.getGenreAnime(genreName, page); - expect(data.animes).not.toEqual([]); - expect(data.genres).not.toEqual([]); - expect(data.topAiringAnimes).not.toEqual([]); + expect(data.animes).not.toEqual([]); + expect(data.genres).not.toEqual([]); + expect(data.topAiringAnimes).not.toEqual([]); }); diff --git a/test/animeProducer.test.ts b/test/animeProducer.test.ts index 53f0d28..c687389 100644 --- a/test/animeProducer.test.ts +++ b/test/animeProducer.test.ts @@ -6,12 +6,12 @@ const page = 2; // npx vitest run animeProducer.test.ts test(`GET /api/v2/hianime/producer/${producerName}?page=${page}`, async () => { - const hianime = new HiAnime.Scraper(); - const data = await hianime.getProducerAnimes(producerName, page); + const hianime = new HiAnime.Scraper(); + const data = await hianime.getProducerAnimes(producerName, page); - expect(data.animes).not.toEqual([]); - expect(data.topAiringAnimes).not.toEqual([]); - expect(data.top10Animes.today).not.toEqual([]); - expect(data.top10Animes.week).not.toEqual([]); - expect(data.top10Animes.month).not.toEqual([]); + expect(data.animes).not.toEqual([]); + expect(data.topAiringAnimes).not.toEqual([]); + expect(data.top10Animes.today).not.toEqual([]); + expect(data.top10Animes.week).not.toEqual([]); + expect(data.top10Animes.month).not.toEqual([]); }); diff --git a/test/animeSearch.test.ts b/test/animeSearch.test.ts index dac66cb..30ad90b 100644 --- a/test/animeSearch.test.ts +++ b/test/animeSearch.test.ts @@ -4,14 +4,14 @@ import { HiAnime } from "aniwatch"; const query = "monster"; const page = 1; const filter: HiAnime.SearchFilters = { - genres: "seinen,psychological", + genres: "seinen,psychological", }; // npx vitest run animeSearch.test.ts test(`GET /api/v2/hianime/search?q=${query}&page=${page}&genres=${filter.genres}`, async () => { - const hianime = new HiAnime.Scraper(); - const data = await hianime.search(query, page, filter); + const hianime = new HiAnime.Scraper(); + const data = await hianime.search(query, page, filter); - expect(data.animes).not.toEqual([]); - expect(data.mostPopularAnimes).not.toEqual([]); + expect(data.animes).not.toEqual([]); + expect(data.mostPopularAnimes).not.toEqual([]); }); diff --git a/test/animeSearchSuggestion.test.ts b/test/animeSearchSuggestion.test.ts index 5957528..434c092 100644 --- a/test/animeSearchSuggestion.test.ts +++ b/test/animeSearchSuggestion.test.ts @@ -5,8 +5,8 @@ const query = "one piece"; // npx vitest run animeSearchSuggestion.test.ts test(`GET /api/v2/hianime/search/suggestion?q=${query}`, async () => { - const hianime = new HiAnime.Scraper(); - const data = await hianime.searchSuggestions(query); + const hianime = new HiAnime.Scraper(); + const data = await hianime.searchSuggestions(query); - expect(data.suggestions).not.toEqual([]); + expect(data.suggestions).not.toEqual([]); }); diff --git a/test/episodeServers.test.ts b/test/episodeServers.test.ts index c044e6c..2064761 100644 --- a/test/episodeServers.test.ts +++ b/test/episodeServers.test.ts @@ -5,11 +5,11 @@ const animeEpisodeId = "steinsgate-0-92?ep=2055"; // npx vitest run episodeServers.test.ts test(`GET /api/v2/hianime/episode/servers?animeEpisodeId=${animeEpisodeId}`, async () => { - const hianime = new HiAnime.Scraper(); - const data = await hianime.getEpisodeServers(animeEpisodeId); + const hianime = new HiAnime.Scraper(); + const data = await hianime.getEpisodeServers(animeEpisodeId); - expect(data.episodeId).not.toEqual(null); - expect(data.episodeNo).not.toEqual(0); - expect(data.sub).not.toEqual([]); - expect(data.dub).not.toEqual([]); + expect(data.episodeId).not.toEqual(null); + expect(data.episodeNo).not.toEqual(0); + expect(data.sub).not.toEqual([]); + expect(data.dub).not.toEqual([]); }); diff --git a/test/estimatedSchedule.test.ts b/test/estimatedSchedule.test.ts index 1e8e086..e714bbe 100644 --- a/test/estimatedSchedule.test.ts +++ b/test/estimatedSchedule.test.ts @@ -5,13 +5,13 @@ const padZero = (num: number) => (num < 10 ? `0${num}` : num.toString()); const d = new Date(); const date = `${d.getFullYear()}-${padZero(d.getMonth() + 1)}-${padZero( - d.getDate() + 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); + const hianime = new HiAnime.Scraper(); + const data = await hianime.getEstimatedSchedule(date); - expect(data.scheduledAnimes).not.toEqual([]); + expect(data.scheduledAnimes).not.toEqual([]); }); diff --git a/test/homePage.test.ts b/test/homePage.test.ts index a5f9e8f..d4fd97f 100644 --- a/test/homePage.test.ts +++ b/test/homePage.test.ts @@ -2,20 +2,20 @@ import { expect, test } from "vitest"; import { HiAnime } from "aniwatch"; test("GET /api/v2/hianime/home", async () => { - const hianime = new HiAnime.Scraper(); - const data = await hianime.getHomePage(); + const hianime = new HiAnime.Scraper(); + const data = await hianime.getHomePage(); - expect(data.spotlightAnimes).not.toEqual([]); - expect(data.trendingAnimes).not.toEqual([]); - expect(data.latestEpisodeAnimes).not.toEqual([]); - expect(data.topUpcomingAnimes).not.toEqual([]); - expect(data.topAiringAnimes).not.toEqual([]); - expect(data.mostPopularAnimes).not.toEqual([]); - expect(data.mostFavoriteAnimes).not.toEqual([]); - expect(data.latestCompletedAnimes).not.toEqual([]); - expect(data.genres).not.toEqual([]); + expect(data.spotlightAnimes).not.toEqual([]); + expect(data.trendingAnimes).not.toEqual([]); + expect(data.latestEpisodeAnimes).not.toEqual([]); + expect(data.topUpcomingAnimes).not.toEqual([]); + expect(data.topAiringAnimes).not.toEqual([]); + expect(data.mostPopularAnimes).not.toEqual([]); + expect(data.mostFavoriteAnimes).not.toEqual([]); + expect(data.latestCompletedAnimes).not.toEqual([]); + expect(data.genres).not.toEqual([]); - expect(data.top10Animes.today).not.toEqual([]); - expect(data.top10Animes.week).not.toEqual([]); - expect(data.top10Animes.month).not.toEqual([]); + expect(data.top10Animes.today).not.toEqual([]); + expect(data.top10Animes.week).not.toEqual([]); + expect(data.top10Animes.month).not.toEqual([]); }); diff --git a/vitest.config.ts b/vitest.config.ts index eb949e4..35991b6 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -1,9 +1,9 @@ import { defineConfig } from "vitest/config"; export default defineConfig({ - test: { - name: "aniwatch-api", - environment: "node", - testTimeout: 15000, - }, + test: { + name: "aniwatch-api", + environment: "node", + testTimeout: 15000, + }, });