fix build errors

This commit is contained in:
Pas 2025-10-24 23:53:33 -06:00
parent 7250d2391d
commit 50090132b0
2 changed files with 22 additions and 6 deletions

View file

@ -10,7 +10,11 @@ const baseUrl = 'https://www3.animeflv.net';
async function searchAnimeFlv(ctx: ShowScrapeContext | MovieScrapeContext, title: string): Promise<string> {
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;

View file

@ -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`;
}