diff --git a/src/providers/sources/warezcdn/index.ts b/src/providers/sources/warezcdn/index.ts index bad2438..1c9ad00 100644 --- a/src/providers/sources/warezcdn/index.ts +++ b/src/providers/sources/warezcdn/index.ts @@ -1,5 +1,6 @@ import { load } from 'cheerio'; +import { flags } from '@/entrypoint/utils/targets'; import { SourcererEmbed, makeSourcerer } from '@/providers/base'; import { mixdropScraper } from '@/providers/embeds/mixdrop'; import { warezcdnembedHlsScraper } from '@/providers/embeds/warezcdn/hls'; @@ -71,7 +72,7 @@ export const warezcdnScraper = makeSourcerer({ id: 'warezcdn', name: 'WarezCDN', rank: 81, - flags: [], + flags: [flags.CORS_ALLOWED], scrapeMovie: universalScraper, scrapeShow: universalScraper, }); diff --git a/src/runners/individualRunner.ts b/src/runners/individualRunner.ts index 6c7e452..b309180 100644 --- a/src/runners/individualRunner.ts +++ b/src/runners/individualRunner.ts @@ -71,7 +71,7 @@ export async function scrapeInvidualSource( // only check for playable streams if there are streams, and if there are no embeds if (output.stream && output.stream.length > 0 && output.embeds.length === 0) { - const playableStreams = await validatePlayableStreams(output.stream, ops); + const playableStreams = await validatePlayableStreams(output.stream, ops, sourceScraper.id); if (playableStreams.length === 0) throw new NotFoundError('No playable streams found'); output.stream = playableStreams; } @@ -112,7 +112,7 @@ export async function scrapeIndividualEmbed( .filter((stream) => flagsAllowedInFeatures(ops.features, stream.flags)); if (output.stream.length === 0) throw new NotFoundError('No streams found'); - const playableStreams = await validatePlayableStreams(output.stream, ops); + const playableStreams = await validatePlayableStreams(output.stream, ops, embedScraper.id); if (playableStreams.length === 0) throw new NotFoundError('No playable streams found'); output.stream = playableStreams; diff --git a/src/runners/runner.ts b/src/runners/runner.ts index c3bc9eb..c5f5de3 100644 --- a/src/runners/runner.ts +++ b/src/runners/runner.ts @@ -104,7 +104,7 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt // return stream is there are any if (output.stream?.[0]) { - const playableStream = await validatePlayableStream(output.stream[0], ops); + const playableStream = await validatePlayableStream(output.stream[0], ops, source.id); if (!playableStream) throw new NotFoundError('No streams found'); return { sourceId: source.id, @@ -151,7 +151,7 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt if (embedOutput.stream.length === 0) { throw new NotFoundError('No streams found'); } - const playableStream = await validatePlayableStream(embedOutput.stream[0], ops); + const playableStream = await validatePlayableStream(embedOutput.stream[0], ops, embed.embedId); if (!playableStream) throw new NotFoundError('No streams found'); embedOutput.stream = [playableStream]; } catch (error) { diff --git a/src/utils/valid.ts b/src/utils/valid.ts index fb9ef0f..e4ea664 100644 --- a/src/utils/valid.ts +++ b/src/utils/valid.ts @@ -1,7 +1,10 @@ +import { warezcdnembedMp4Scraper } from '@/providers/embeds/warezcdn/mp4'; import { Stream } from '@/providers/streams'; import { IndividualEmbedRunnerOptions } from '@/runners/individualRunner'; import { ProviderRunnerOptions } from '@/runners/runner'; +const SKIP_VALIDATION_CHECK_IDS = [warezcdnembedMp4Scraper.id]; + export function isValidStream(stream: Stream | undefined): boolean { if (!stream) return false; if (stream.type === 'hls') { @@ -21,7 +24,10 @@ export function isValidStream(stream: Stream | undefined): boolean { export async function validatePlayableStream( stream: Stream, ops: ProviderRunnerOptions | IndividualEmbedRunnerOptions, + sourcererId: string, ): Promise { + if (SKIP_VALIDATION_CHECK_IDS.includes(sourcererId)) return stream; + if (stream.type === 'hls') { const result = await ops.proxiedFetcher.full(stream.playlist, { method: 'GET', @@ -63,8 +69,11 @@ export async function validatePlayableStream( export async function validatePlayableStreams( streams: Stream[], ops: ProviderRunnerOptions | IndividualEmbedRunnerOptions, + sourcererId: string, ): Promise { - return (await Promise.all(streams.map((stream) => validatePlayableStream(stream, ops)))).filter( + if (SKIP_VALIDATION_CHECK_IDS.includes(sourcererId)) return streams; + + return (await Promise.all(streams.map((stream) => validatePlayableStream(stream, ops, sourcererId)))).filter( (v) => v !== null, ) as Stream[]; }