mirror of
https://github.com/p-stream/providers.git
synced 2026-05-19 09:12:07 +00:00
fix build errors
This commit is contained in:
parent
7250d2391d
commit
50090132b0
2 changed files with 22 additions and 6 deletions
|
|
@ -10,7 +10,11 @@ const baseUrl = 'https://www3.animeflv.net';
|
||||||
|
|
||||||
async function searchAnimeFlv(ctx: ShowScrapeContext | MovieScrapeContext, title: string): Promise<string> {
|
async function searchAnimeFlv(ctx: ShowScrapeContext | MovieScrapeContext, title: string): Promise<string> {
|
||||||
const searchUrl = `${baseUrl}/browse?q=${encodeURIComponent(title)}`;
|
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 $ = load(html);
|
||||||
|
|
||||||
const results = $('div.Container ul.ListAnimes li article');
|
const results = $('div.Container ul.ListAnimes li article');
|
||||||
|
|
@ -39,7 +43,11 @@ async function getEpisodes(
|
||||||
ctx: ShowScrapeContext | MovieScrapeContext,
|
ctx: ShowScrapeContext | MovieScrapeContext,
|
||||||
animeUrl: string,
|
animeUrl: string,
|
||||||
): Promise<{ number: number; url: 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);
|
const $ = load(html);
|
||||||
|
|
||||||
let episodes: { number: number; url: string }[] = [];
|
let episodes: { number: number; url: string }[] = [];
|
||||||
|
|
@ -74,7 +82,11 @@ async function getEmbeds(
|
||||||
ctx: ShowScrapeContext | MovieScrapeContext,
|
ctx: ShowScrapeContext | MovieScrapeContext,
|
||||||
episodeUrl: string,
|
episodeUrl: string,
|
||||||
): Promise<{ [key: string]: string | undefined }> {
|
): 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);
|
const $ = load(html);
|
||||||
|
|
||||||
// Busca el script que contiene la variable videos
|
// Busca el script que contiene la variable videos
|
||||||
|
|
@ -87,7 +99,7 @@ async function getEmbeds(
|
||||||
|
|
||||||
let videos: any = {};
|
let videos: any = {};
|
||||||
try {
|
try {
|
||||||
videos = eval(`(${match[1]})`);
|
videos = JSON.parse(match[1]);
|
||||||
} catch {
|
} catch {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
@ -143,7 +155,11 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
||||||
|
|
||||||
episodeUrl = ep.url;
|
episodeUrl = ep.url;
|
||||||
} else if (ctx.media.type === 'movie') {
|
} 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);
|
const $ = load(html);
|
||||||
|
|
||||||
let animeUri: string | null = null;
|
let animeUri: string | null = null;
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
|
||||||
const matches = [...showPageResult.matchAll(regexPattern)];
|
const matches = [...showPageResult.matchAll(regexPattern)];
|
||||||
const episodeIds = matches.map((match) => match[1]);
|
const episodeIds = matches.map((match) => match[1]);
|
||||||
if (episodeIds.length === 0) throw new NotFoundError('No watchable item found');
|
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`;
|
iframeSourceUrl = `/episodes/${episodeId}/videos`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue