From 50090132b050b17c17d5ab56da98d29fbde56f75 Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Fri, 24 Oct 2025 23:53:33 -0600 Subject: [PATCH] fix build errors --- src/providers/sources/animeflv.ts | 26 ++++++++++++++++++----- src/providers/sources/ridomovies/index.ts | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/providers/sources/animeflv.ts b/src/providers/sources/animeflv.ts index fd5a2a1..2fd3bed 100644 --- a/src/providers/sources/animeflv.ts +++ b/src/providers/sources/animeflv.ts @@ -10,7 +10,11 @@ const baseUrl = 'https://www3.animeflv.net'; async function searchAnimeFlv(ctx: ShowScrapeContext | MovieScrapeContext, title: string): Promise { const searchUrl = `${baseUrl}/browse?q=${encodeURIComponent(title)}`; - const html = await ctx.proxiedFetcher(searchUrl); + const html = await ctx.proxiedFetcher(searchUrl, { + headers: { + Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + }, + }); const $ = load(html); const results = $('div.Container ul.ListAnimes li article'); @@ -39,7 +43,11 @@ async function getEpisodes( ctx: ShowScrapeContext | MovieScrapeContext, animeUrl: string, ): Promise<{ number: number; url: string }[]> { - const html = await ctx.proxiedFetcher(animeUrl); + const html = await ctx.proxiedFetcher(animeUrl, { + headers: { + Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + }, + }); const $ = load(html); let episodes: { number: number; url: string }[] = []; @@ -74,7 +82,11 @@ async function getEmbeds( ctx: ShowScrapeContext | MovieScrapeContext, episodeUrl: string, ): Promise<{ [key: string]: string | undefined }> { - const html = await ctx.proxiedFetcher(episodeUrl); + const html = await ctx.proxiedFetcher(episodeUrl, { + headers: { + Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + }, + }); const $ = load(html); // Busca el script que contiene la variable videos @@ -87,7 +99,7 @@ async function getEmbeds( let videos: any = {}; try { - videos = eval(`(${match[1]})`); + videos = JSON.parse(match[1]); } catch { return {}; } @@ -143,7 +155,11 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis episodeUrl = ep.url; } else if (ctx.media.type === 'movie') { - const html = await ctx.proxiedFetcher(animeUrl); + const html = await ctx.proxiedFetcher(animeUrl, { + headers: { + Accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', + }, + }); const $ = load(html); let animeUri: string | null = null; diff --git a/src/providers/sources/ridomovies/index.ts b/src/providers/sources/ridomovies/index.ts index 41127d8..1dd6abe 100644 --- a/src/providers/sources/ridomovies/index.ts +++ b/src/providers/sources/ridomovies/index.ts @@ -42,7 +42,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) => const matches = [...showPageResult.matchAll(regexPattern)]; const episodeIds = matches.map((match) => match[1]); if (episodeIds.length === 0) throw new NotFoundError('No watchable item found'); - const episodeId = episodeIds.at(-1); + const episodeId = episodeIds[episodeIds.length - 1]; iframeSourceUrl = `/episodes/${episodeId}/videos`; }