aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWBRK-dev <[email protected]>2024-04-28 10:26:39 +0200
committerWBRK-dev <[email protected]>2024-04-28 10:26:39 +0200
commita0d039ecc120cfeb8352c6b525ee1e766555f9ec (patch)
tree3b379b2547272ab67f4e2a557f04ccbeacf98f0e /src
parent22599a38d9e08c4dc5cd325c53f5509980f435fe (diff)
downloadaniwatch-api-a0d039ecc120cfeb8352c6b525ee1e766555f9ec.tar.xz
aniwatch-api-a0d039ecc120cfeb8352c6b525ee1e766555f9ec.zip
feat: added the ability to grab episode sources from raw servers in endpoint `/episode-srcs`
Diffstat (limited to 'src')
-rw-r--r--src/parsers/animeEpisodeSrcs.ts2
-rw-r--r--src/types/anime.ts1
-rw-r--r--src/utils/methods.ts2
3 files changed, 3 insertions, 2 deletions
diff --git a/src/parsers/animeEpisodeSrcs.ts b/src/parsers/animeEpisodeSrcs.ts
index 104bc4d..913c535 100644
--- a/src/parsers/animeEpisodeSrcs.ts
+++ b/src/parsers/animeEpisodeSrcs.ts
@@ -25,7 +25,7 @@ import { type ScrapedAnimeEpisodesSources } from "../types/parsers/index.js";
async function scrapeAnimeEpisodeSources(
episodeId: string,
server: AnimeServers = Servers.VidStreaming,
- category: "sub" | "dub" = "sub"
+ category: "sub" | "dub" | "raw" = "sub"
): Promise<ScrapedAnimeEpisodesSources | HttpError> {
if (episodeId.startsWith("http")) {
const serverUrl = new URL(episodeId);
diff --git a/src/types/anime.ts b/src/types/anime.ts
index abb15f2..9af00bc 100644
--- a/src/types/anime.ts
+++ b/src/types/anime.ts
@@ -75,6 +75,7 @@ export interface SubEpisode {
serverId: number | null;
}
export interface DubEpisode extends SubEpisode {}
+export interface RawEpisode extends SubEpisode {}
export type AnimeCategories =
| "most-favorite"
diff --git a/src/utils/methods.ts b/src/utils/methods.ts
index 9d89822..1ed0c88 100644
--- a/src/utils/methods.ts
+++ b/src/utils/methods.ts
@@ -191,7 +191,7 @@ export const extractMostPopularAnimes = (
export function retrieveServerId(
$: CheerioAPI,
index: number,
- category: "sub" | "dub"
+ category: "sub" | "dub" | "raw"
) {
return (
$(`.ps_-block.ps_-block-sub.servers-${category} > .ps__-list .server-item`)