diff options
| author | WBRK-dev <[email protected]> | 2024-07-21 10:18:05 +0200 |
|---|---|---|
| committer | WBRK-dev <[email protected]> | 2024-07-21 10:18:05 +0200 |
| commit | 5d929461ce918006b9c3977e5af5f76799e820b3 (patch) | |
| tree | 39c624d91029959ad0d4f2af8e1dd8b911d6f728 /src | |
| parent | 62fa83a56d5e5ea4cc5e7b38b478208b0c5e6a72 (diff) | |
| download | aniwatch-api-5d929461ce918006b9c3977e5af5f76799e820b3.tar.xz aniwatch-api-5d929461ce918006b9c3977e5af5f76799e820b3.zip | |
feat: added `mostPopular`, `mostFavorite` and `latestCompleted` to the home route response
Diffstat (limited to 'src')
| -rw-r--r-- | src/parsers/homePage.ts | 6 | ||||
| -rw-r--r-- | src/types/anime.ts | 2 | ||||
| -rw-r--r-- | src/types/parsers/homePage.ts | 6 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/parsers/homePage.ts b/src/parsers/homePage.ts index b03b94e..1409a09 100644 --- a/src/parsers/homePage.ts +++ b/src/parsers/homePage.ts @@ -25,6 +25,9 @@ async function scrapeHomePage(): Promise<ScrapedHomePage | HttpError> { month: [], }, topAiringAnimes: [], + mostPopularAnimes: [], + mostFavoriteAnimes: [], + latestCompletedAnimes: [], genres: [], }; @@ -160,6 +163,9 @@ async function scrapeHomePage(): Promise<ScrapedHomePage | HttpError> { }); res.topAiringAnimes = extractMostPopularAnimes($, "#anime-featured .row div:nth-of-type(1) .anif-block-ul ul li"); + res.mostPopularAnimes = extractMostPopularAnimes($, "#anime-featured .row div:nth-of-type(2) .anif-block-ul ul li"); + res.mostFavoriteAnimes = extractMostPopularAnimes($, "#anime-featured .row div:nth-of-type(3) .anif-block-ul ul li"); + res.latestCompletedAnimes = extractMostPopularAnimes($, "#anime-featured .row div:nth-of-type(4) .anif-block-ul ul li"); return res; } catch (err: any) { diff --git a/src/types/anime.ts b/src/types/anime.ts index 52bf13a..0d32382 100644 --- a/src/types/anime.ts +++ b/src/types/anime.ts @@ -39,6 +39,8 @@ export interface LatestEpisodeAnime extends Anime {} export interface TopUpcomingAnime extends Anime {} export interface TopAiringAnime extends MostPopularAnime {} +export interface MostFavoriteAnime extends MostPopularAnime {} +export interface LatestCompletedAnime extends MostPopularAnime {} export interface AnimeGeneralAboutInfo extends Pick<Anime, CommonAnimeProps>, diff --git a/src/types/parsers/homePage.ts b/src/types/parsers/homePage.ts index 5641a9a..23f6284 100644 --- a/src/types/parsers/homePage.ts +++ b/src/types/parsers/homePage.ts @@ -4,6 +4,9 @@ import type { TopAiringAnime, TopUpcomingAnime, LatestEpisodeAnime, + MostFavoriteAnime, + MostPopularAnime, + LatestCompletedAnime, } from "../anime.js"; import type { HttpError } from "http-errors"; import type { ScrapedAnimeCategory } from "./animeCategory.js"; @@ -15,4 +18,7 @@ export interface ScrapedHomePage latestEpisodeAnimes: Array<LatestEpisodeAnime> | HttpError; topUpcomingAnimes: Array<TopUpcomingAnime> | HttpError; topAiringAnimes: Array<TopAiringAnime> | HttpError; + mostPopularAnimes: Array<MostPopularAnime> | HttpError; + mostFavoriteAnimes: Array<MostFavoriteAnime> | HttpError; + latestCompletedAnimes: Array<LatestCompletedAnime> | HttpError; } |
