fix: update amvstrm url

This commit is contained in:
2024-08-18 16:08:28 -04:00
parent c88ef4dcc9
commit ec150f81ea
8 changed files with 72 additions and 77 deletions

View File

@@ -5,7 +5,7 @@ export async function getEpisodesFromAmvstrm(
): Promise<EpisodesResponse | null> { ): Promise<EpisodesResponse | null> {
try { try {
const episodes: Episode[] | null = await fetch( const episodes: Episode[] | null = await fetch(
`https://api-amvstrm.nyt92.eu.org/api/v2/episode/${aniListId}`, `https://api.amvstr.me/api/v2/episode/${aniListId}`,
) )
.then((res) => res.json<AmvstrmEpisodesResponse>()) .then((res) => res.json<AmvstrmEpisodesResponse>())
.then(({ code, message, episodes }) => { .then(({ code, message, episodes }) => {

View File

@@ -3,9 +3,7 @@ import type { FetchUrlResponse } from "./responseType";
export async function getSourcesFromAmvstrm( export async function getSourcesFromAmvstrm(
watchId: string, watchId: string,
): Promise<FetchUrlResponse | null> { ): Promise<FetchUrlResponse | null> {
const source = await fetch( const source = await fetch(`https://api.amvstr.me/api/v2/stream/${watchId}`)
`https://api-amvstrm.nyt92.eu.org/api/v2/stream/${watchId}`,
)
.then((res) => res.json<AmvstrmStreamResponse>()) .then((res) => res.json<AmvstrmStreamResponse>())
.then(({ stream }) => { .then(({ stream }) => {
const streamObj = stream?.multi; const streamObj = stream?.multi;

View File

@@ -4,7 +4,7 @@ export async function fetchSearchResultsFromAmvstrm(
limit: number, limit: number,
) { ) {
return fetch( return fetch(
`https://api-amvstrm.nyt92.eu.org/api/v2/search?q=${query}&p=${page}&limit=${limit}`, `https://api.amvstr.me/api/v2/search?q=${query}&p=${page}&limit=${limit}`,
) )
.then((res) => res.json<any>()) .then((res) => res.json<any>())
.then(({ pageInfo: { hasNextPage }, results }) => ({ .then(({ pageInfo: { hasNextPage }, results }) => ({

View File

@@ -4,8 +4,8 @@ export async function fetchTitleFromAmvstrm(
aniListId: number, aniListId: number,
): Promise<Title | undefined> { ): Promise<Title | undefined> {
return Promise.all([ return Promise.all([
fetch(`https://api-amvstrm.nyt92.eu.org/api/v2/info/${aniListId}`).then( fetch(`https://api.amvstr.me/api/v2/info/${aniListId}`).then((res) =>
(res) => res.json<any>(), res.json<any>(),
), ),
fetchMissingInformationFromAnify(aniListId).catch((err) => { fetchMissingInformationFromAnify(aniListId).catch((err) => {
console.error("Failed to get missing information from Anify", err); console.error("Failed to get missing information from Anify", err);

View File

@@ -2,7 +2,7 @@ import { HttpResponse, http } from "msw";
export function getAmvstrmEpisodes() { export function getAmvstrmEpisodes() {
return http.get( return http.get(
"https://api-amvstrm.nyt92.eu.org/api/v2/episode/:aniListId", "https://api.amvstr.me/api/v2/episode/:aniListId",
({ params }) => { ({ params }) => {
const aniListId = Number(params["aniListId"]); const aniListId = Number(params["aniListId"]);
if (aniListId === 4) { if (aniListId === 4) {

View File

@@ -2,7 +2,7 @@ import { HttpResponse, http } from "msw";
export function getAmvstrmSearchResults() { export function getAmvstrmSearchResults() {
return http.get( return http.get(
"https://api-amvstrm.nyt92.eu.org/api/v2/search", "https://api.amvstr.me/api/v2/search",
({ request: { url: urlString } }) => { ({ request: { url: urlString } }) => {
const url = new URL(urlString); const url = new URL(urlString);
const query = url.searchParams.get("q"); const query = url.searchParams.get("q");

View File

@@ -1,9 +1,7 @@
import { HttpResponse, http } from "msw"; import { HttpResponse, http } from "msw";
export function getAmvstrmSources() { export function getAmvstrmSources() {
return http.get( return http.get("https://api.amvstr.me/api/v2/stream/:id", ({ params }) => {
"https://api-amvstrm.nyt92.eu.org/api/v2/stream/:id",
({ params }) => {
const { id } = params; const { id } = params;
if (id === "unknown") { if (id === "unknown") {
@@ -72,6 +70,5 @@ export function getAmvstrmSources() {
"https://nspl.nyt92.eu.org/player?p=JnRpdGxlPW11c2hva3UtdGVuc2VpLWlpLWlzZWthaS1pdHRhcmEtaG9ua2ktZGFzdS1wYXJ0LTItZXBpc29kZS0xJmZpbGU9aHR0cHM6Ly93d3cwMzIuYW5pY2Ruc3RyZWFtLmluZm8vdmlkZW9zL2hscy82T2d6dDRVT0pQYnpjaUpNOEVKdmdnLzE3MTcxMzc0MTAvMjIzNDE5L2FhODA0YTI0MDA1MzVkODRkZDU5NDU0YjI4ZDMyOWZiL2VwLjEuMTcxMjUwNDA2NS5tM3U4JnRodW1ibmFpbHM9dW5kZWZpbmVk", "https://nspl.nyt92.eu.org/player?p=JnRpdGxlPW11c2hva3UtdGVuc2VpLWlpLWlzZWthaS1pdHRhcmEtaG9ua2ktZGFzdS1wYXJ0LTItZXBpc29kZS0xJmZpbGU9aHR0cHM6Ly93d3cwMzIuYW5pY2Ruc3RyZWFtLmluZm8vdmlkZW9zL2hscy82T2d6dDRVT0pQYnpjaUpNOEVKdmdnLzE3MTcxMzc0MTAvMjIzNDE5L2FhODA0YTI0MDA1MzVkODRkZDU5NDU0YjI4ZDMyOWZiL2VwLjEuMTcxMjUwNDA2NS5tM3U4JnRodW1ibmFpbHM9dW5kZWZpbmVk",
}, },
}); });
}, });
);
} }

View File

@@ -2,7 +2,7 @@ import { HttpResponse, http } from "msw";
export function getAmvstrmTitle() { export function getAmvstrmTitle() {
return http.get( return http.get(
"https://api-amvstrm.nyt92.eu.org/api/v2/info/:aniListId", "https://api.amvstr.me/api/v2/info/:aniListId",
({ params }) => { ({ params }) => {
const aniListId = Number(params["aniListId"] as string); const aniListId = Number(params["aniListId"] as string);