fix: update anify url

This commit is contained in:
2024-08-12 18:56:25 -04:00
parent 713bb59780
commit 0e30b6b7d3
6 changed files with 153 additions and 150 deletions

View File

@@ -15,7 +15,7 @@ export async function getEpisodesFromAnify(
const abortController = new AbortController(); const abortController = new AbortController();
try { try {
response = await promiseTimeout( response = await promiseTimeout(
fetch(`https://api.anify.tv/episodes/${aniListId}`, { fetch(`https://anify.eltik.cc/episodes/${aniListId}`, {
signal: abortController.signal, signal: abortController.signal,
}).then((res) => res.json<AnifyEpisodesResponse[]>()), }).then((res) => res.json<AnifyEpisodesResponse[]>()),
30 * 1000, 30 * 1000,

View File

@@ -12,7 +12,7 @@ export async function getSourcesFromAnify(
watchId: string, watchId: string,
aniListId: number, aniListId: number,
): Promise<FetchUrlResponse | null> { ): Promise<FetchUrlResponse | null> {
const response = await fetch("https://api.anify.tv/sources", { const response = await fetch("https://anify.eltik.cc/sources", {
body: JSON.stringify({ body: JSON.stringify({
watchId, watchId,
providerId: provider, providerId: provider,

View File

@@ -53,7 +53,7 @@ type AnifyInformation = {
function fetchMissingInformationFromAnify( function fetchMissingInformationFromAnify(
aniListId: number, aniListId: number,
): Promise<AnifyInformation> { ): Promise<AnifyInformation> {
return fetch(`https://api.anify.tv/info?id=${aniListId}`) return fetch(`https://anify.eltik.cc/info?id=${aniListId}`)
.then((res) => res.json() as Promise<AnifyInformation>) .then((res) => res.json() as Promise<AnifyInformation>)
.then(({ bannerImage, countryOfOrigin }) => ({ .then(({ bannerImage, countryOfOrigin }) => ({
bannerImage, bannerImage,

View File

@@ -1,150 +1,153 @@
import { HttpResponse, http } from "msw"; import { HttpResponse, http } from "msw";
export function getAnifyEpisodes() { export function getAnifyEpisodes() {
return http.get("https://api.anify.tv/episodes/:aniListId", ({ params }) => { return http.get(
const aniListId = Number(params["aniListId"]); "https://anify.eltik.cc/episodes/:aniListId",
if (aniListId === 3 || aniListId === 4 || aniListId < 0) { ({ params }) => {
return HttpResponse.json([]); const aniListId = Number(params["aniListId"]);
} if (aniListId === 3 || aniListId === 4 || aniListId < 0) {
return HttpResponse.json([]);
}
return HttpResponse.json([ return HttpResponse.json([
{ {
providerId: "zoro", providerId: "zoro",
episodes: [ episodes: [
{ {
id: "/watch/spy-classroom-season-2-18468?ep=103233", id: "/watch/spy-classroom-season-2-18468?ep=103233",
isFiller: false, isFiller: false,
number: 1, number: 1,
title: "Mission: Forgetter I", title: "Mission: Forgetter I",
img: null, img: null,
hasDub: false, hasDub: false,
description: null, description: null,
rating: null, rating: null,
updatedAt: 0, updatedAt: 0,
}, },
{ {
id: "/watch/spy-classroom-season-2-18468?ep=103632", id: "/watch/spy-classroom-season-2-18468?ep=103632",
isFiller: false, isFiller: false,
number: 2, number: 2,
title: "Mission: Forgetter II", title: "Mission: Forgetter II",
img: null, img: null,
hasDub: false, hasDub: false,
description: null, description: null,
rating: null, rating: null,
updatedAt: 0, updatedAt: 0,
}, },
{ {
id: "/watch/spy-classroom-season-2-18468?ep=104244", id: "/watch/spy-classroom-season-2-18468?ep=104244",
isFiller: false, isFiller: false,
number: 3, number: 3,
title: "Mission: Forgetter III", title: "Mission: Forgetter III",
img: null, img: null,
hasDub: false, hasDub: false,
description: null, description: null,
rating: null, rating: null,
updatedAt: 0, updatedAt: 0,
}, },
{ {
id: "/watch/spy-classroom-season-2-18468?ep=104620", id: "/watch/spy-classroom-season-2-18468?ep=104620",
isFiller: false, isFiller: false,
number: 4, number: 4,
title: "Mission: Forgetter IV", title: "Mission: Forgetter IV",
img: null, img: null,
hasDub: false, hasDub: false,
description: null, description: null,
rating: null, rating: null,
updatedAt: 0, updatedAt: 0,
}, },
{ {
id: "/watch/spy-classroom-season-2-18468?ep=104844", id: "/watch/spy-classroom-season-2-18468?ep=104844",
isFiller: false, isFiller: false,
number: 5, number: 5,
title: "File: Glint", title: "File: Glint",
img: null, img: null,
hasDub: false, hasDub: false,
description: null, description: null,
rating: null, rating: null,
updatedAt: 0, updatedAt: 0,
}, },
{ {
id: "/watch/spy-classroom-season-2-18468?ep=105761", id: "/watch/spy-classroom-season-2-18468?ep=105761",
isFiller: false, isFiller: false,
number: 6, number: 6,
title: "File: Dreamspeaker Thea", title: "File: Dreamspeaker Thea",
img: null, img: null,
hasDub: false, hasDub: false,
description: null, description: null,
rating: null, rating: null,
updatedAt: 0, updatedAt: 0,
}, },
{ {
id: "/watch/spy-classroom-season-2-18468?ep=106135", id: "/watch/spy-classroom-season-2-18468?ep=106135",
isFiller: false, isFiller: false,
number: 7, number: 7,
title: "File: Forgetter Annette", title: "File: Forgetter Annette",
img: null, img: null,
hasDub: false, hasDub: false,
description: null, description: null,
rating: null, rating: null,
updatedAt: 0, updatedAt: 0,
}, },
{ {
id: "/watch/spy-classroom-season-2-18468?ep=106518", id: "/watch/spy-classroom-season-2-18468?ep=106518",
isFiller: false, isFiller: false,
number: 8, number: 8,
title: "Mission: Dreamspeaker I", title: "Mission: Dreamspeaker I",
img: null, img: null,
hasDub: false, hasDub: false,
description: null, description: null,
rating: null, rating: null,
updatedAt: 0, updatedAt: 0,
}, },
{ {
id: "/watch/spy-classroom-season-2-18468?ep=106606", id: "/watch/spy-classroom-season-2-18468?ep=106606",
isFiller: false, isFiller: false,
number: 9, number: 9,
title: "Mission: Dreamspeaker II", title: "Mission: Dreamspeaker II",
img: null, img: null,
hasDub: false, hasDub: false,
description: null, description: null,
rating: null, rating: null,
updatedAt: 0, updatedAt: 0,
}, },
{ {
id: "/watch/spy-classroom-season-2-18468?ep=106981", id: "/watch/spy-classroom-season-2-18468?ep=106981",
isFiller: false, isFiller: false,
number: 10, number: 10,
title: "Mission: Dreamspeaker III", title: "Mission: Dreamspeaker III",
img: null, img: null,
hasDub: false, hasDub: false,
description: null, description: null,
rating: null, rating: null,
updatedAt: 0, updatedAt: 0,
}, },
{ {
id: "/watch/spy-classroom-season-2-18468?ep=107176", id: "/watch/spy-classroom-season-2-18468?ep=107176",
isFiller: false, isFiller: false,
number: 11, number: 11,
title: "Mission: Dreamspeaker IV", title: "Mission: Dreamspeaker IV",
img: null, img: null,
hasDub: false, hasDub: false,
description: null, description: null,
rating: null, rating: null,
updatedAt: 0, updatedAt: 0,
}, },
{ {
id: "/watch/spy-classroom-season-2-18468?ep=107247", id: "/watch/spy-classroom-season-2-18468?ep=107247",
isFiller: false, isFiller: false,
number: 12, number: 12,
title: "File: Flower Garden Lily", title: "File: Flower Garden Lily",
img: null, img: null,
hasDub: false, hasDub: false,
description: null, description: null,
rating: null, rating: null,
updatedAt: 0, updatedAt: 0,
}, },
], ],
}, },
]); ]);
}); },
);
} }

View File

@@ -1,7 +1,7 @@
import { HttpResponse, http } from "msw"; import { HttpResponse, http } from "msw";
export function getAnifySources() { export function getAnifySources() {
return http.post("https://api.anify.tv/sources", async ({ request }) => { return http.post("https://anify.eltik.cc/sources", async ({ request }) => {
const { id: aniListId } = await request.json(); const { id: aniListId } = await request.json();
if (aniListId < 0) { if (aniListId < 0) {
return HttpResponse.json({ sources: [] }); return HttpResponse.json({ sources: [] });

View File

@@ -1,7 +1,7 @@
import { HttpResponse, http } from "msw"; import { HttpResponse, http } from "msw";
export function getAnifyTitle() { export function getAnifyTitle() {
return http.get(`https://api.anify.tv/info`, ({ request }) => { return http.get(`https://anify.eltik.cc/info`, ({ request }) => {
// Construct a URL instance out of the intercepted request. // Construct a URL instance out of the intercepted request.
const url = new URL(request.url); const url = new URL(request.url);
const id = url.searchParams.get("id"); const id = url.searchParams.get("id");