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 | -- |
|
||||
| `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
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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`)
|
||||
|
||||
Reference in New Issue
Block a user