feat: added the ability to grab episode sources from raw servers in endpoint /episode-srcs
This commit is contained in:
@@ -922,7 +922,7 @@ https://api-aniwatch.onrender.com/anime/episode-srcs?id={episodeId}&server={serv
|
|||||||
| :--------: | :----: | :-------------------------------------------: | :-------: | :--------------: |
|
| :--------: | :----: | :-------------------------------------------: | :-------: | :--------------: |
|
||||||
| `id` | string | The id of the episode. | Yes | -- |
|
| `id` | string | The id of the episode. | Yes | -- |
|
||||||
| `server` | string | The name of the server. | No | `"vidstreaming"` |
|
| `server` | string | The name of the server. | No | `"vidstreaming"` |
|
||||||
| `category` | string | The category of the episode ('sub' or 'dub'). | No | `"sub"` |
|
| `category` | string | The category of the episode ('sub', 'dub' or 'raw'). | No | `"sub"` |
|
||||||
|
|
||||||
#### Request sample
|
#### Request sample
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import { type ScrapedAnimeEpisodesSources } from "../types/parsers/index.js";
|
|||||||
async function scrapeAnimeEpisodeSources(
|
async function scrapeAnimeEpisodeSources(
|
||||||
episodeId: string,
|
episodeId: string,
|
||||||
server: AnimeServers = Servers.VidStreaming,
|
server: AnimeServers = Servers.VidStreaming,
|
||||||
category: "sub" | "dub" = "sub"
|
category: "sub" | "dub" | "raw" = "sub"
|
||||||
): Promise<ScrapedAnimeEpisodesSources | HttpError> {
|
): Promise<ScrapedAnimeEpisodesSources | HttpError> {
|
||||||
if (episodeId.startsWith("http")) {
|
if (episodeId.startsWith("http")) {
|
||||||
const serverUrl = new URL(episodeId);
|
const serverUrl = new URL(episodeId);
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ export interface SubEpisode {
|
|||||||
serverId: number | null;
|
serverId: number | null;
|
||||||
}
|
}
|
||||||
export interface DubEpisode extends SubEpisode {}
|
export interface DubEpisode extends SubEpisode {}
|
||||||
|
export interface RawEpisode extends SubEpisode {}
|
||||||
|
|
||||||
export type AnimeCategories =
|
export type AnimeCategories =
|
||||||
| "most-favorite"
|
| "most-favorite"
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ export const extractMostPopularAnimes = (
|
|||||||
export function retrieveServerId(
|
export function retrieveServerId(
|
||||||
$: CheerioAPI,
|
$: CheerioAPI,
|
||||||
index: number,
|
index: number,
|
||||||
category: "sub" | "dub"
|
category: "sub" | "dub" | "raw"
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
$(`.ps_-block.ps_-block-sub.servers-${category} > .ps__-list .server-item`)
|
$(`.ps_-block.ps_-block-sub.servers-${category} > .ps__-list .server-item`)
|
||||||
|
|||||||
Reference in New Issue
Block a user