feat: add Amvstrm as source for /episodes

Summary:

Test Plan:
This commit is contained in:
2024-05-26 13:22:03 -04:00
parent e91f92354c
commit b661b59078
7 changed files with 125 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
import { HttpResponse, http } from "msw";
export function getAmvstrmEpisodes() {
return http.get(
"https://api-amvstrm.nyt92.eu.org/api/v2/episode/:aniListId",
({ params }) => {
const aniListId = Number(params["aniListId"]);
if (aniListId === 4) {
return HttpResponse.json({
code: 200,
message: "success",
episodes: [
{
id: "amvstrm-1",
episode: 1,
title: "EP 1",
isFiller: false,
isDub: false,
image: null,
},
],
});
}
return HttpResponse.json(
{ code: 500, message: "Server error", episodes: [] },
{ status: 500 },
);
},
);
}

View File

@@ -3,7 +3,7 @@ import { HttpResponse, http } from "msw";
export function getAnifyEpisodes() {
return http.get("https://api.anify.tv/episodes/:aniListId", ({ params }) => {
const aniListId = Number(params["aniListId"]);
if (aniListId === 3 || aniListId < 0) {
if (aniListId === 3 || aniListId === 4 || aniListId < 0) {
return HttpResponse.json([]);
}

View File

@@ -1,3 +1,4 @@
import { getAmvstrmEpisodes } from "./amvstrm/episodes";
import { getAmvstrmSearchResults } from "./amvstrm/search";
import { getAmvstrmTitle } from "./amvstrm/title";
import { getAnifyEpisodes } from "./anify/episodes";
@@ -8,6 +9,7 @@ import { getAnilistTitle } from "./anilist/title";
export const handlers = [
getAnilistSearchResults(),
getAnilistTitle(),
getAmvstrmEpisodes(),
getAmvstrmSearchResults(),
getAmvstrmTitle(),
getAnifyEpisodes(),