skip validation check for warezcdnmp4
This commit is contained in:
parent
ef600dd08c
commit
94bfcd0c31
|
@ -1,5 +1,6 @@
|
||||||
import { load } from 'cheerio';
|
import { load } from 'cheerio';
|
||||||
|
|
||||||
|
import { flags } from '@/entrypoint/utils/targets';
|
||||||
import { SourcererEmbed, makeSourcerer } from '@/providers/base';
|
import { SourcererEmbed, makeSourcerer } from '@/providers/base';
|
||||||
import { mixdropScraper } from '@/providers/embeds/mixdrop';
|
import { mixdropScraper } from '@/providers/embeds/mixdrop';
|
||||||
import { warezcdnembedHlsScraper } from '@/providers/embeds/warezcdn/hls';
|
import { warezcdnembedHlsScraper } from '@/providers/embeds/warezcdn/hls';
|
||||||
|
@ -71,7 +72,7 @@ export const warezcdnScraper = makeSourcerer({
|
||||||
id: 'warezcdn',
|
id: 'warezcdn',
|
||||||
name: 'WarezCDN',
|
name: 'WarezCDN',
|
||||||
rank: 81,
|
rank: 81,
|
||||||
flags: [],
|
flags: [flags.CORS_ALLOWED],
|
||||||
scrapeMovie: universalScraper,
|
scrapeMovie: universalScraper,
|
||||||
scrapeShow: universalScraper,
|
scrapeShow: universalScraper,
|
||||||
});
|
});
|
||||||
|
|
|
@ -71,7 +71,7 @@ export async function scrapeInvidualSource(
|
||||||
|
|
||||||
// only check for playable streams if there are streams, and if there are no embeds
|
// 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) {
|
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');
|
if (playableStreams.length === 0) throw new NotFoundError('No playable streams found');
|
||||||
output.stream = playableStreams;
|
output.stream = playableStreams;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ export async function scrapeIndividualEmbed(
|
||||||
.filter((stream) => flagsAllowedInFeatures(ops.features, stream.flags));
|
.filter((stream) => flagsAllowedInFeatures(ops.features, stream.flags));
|
||||||
if (output.stream.length === 0) throw new NotFoundError('No streams found');
|
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');
|
if (playableStreams.length === 0) throw new NotFoundError('No playable streams found');
|
||||||
output.stream = playableStreams;
|
output.stream = playableStreams;
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
|
||||||
|
|
||||||
// return stream is there are any
|
// return stream is there are any
|
||||||
if (output.stream?.[0]) {
|
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');
|
if (!playableStream) throw new NotFoundError('No streams found');
|
||||||
return {
|
return {
|
||||||
sourceId: source.id,
|
sourceId: source.id,
|
||||||
|
@ -151,7 +151,7 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
|
||||||
if (embedOutput.stream.length === 0) {
|
if (embedOutput.stream.length === 0) {
|
||||||
throw new NotFoundError('No streams found');
|
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');
|
if (!playableStream) throw new NotFoundError('No streams found');
|
||||||
embedOutput.stream = [playableStream];
|
embedOutput.stream = [playableStream];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
|
import { warezcdnembedMp4Scraper } from '@/providers/embeds/warezcdn/mp4';
|
||||||
import { Stream } from '@/providers/streams';
|
import { Stream } from '@/providers/streams';
|
||||||
import { IndividualEmbedRunnerOptions } from '@/runners/individualRunner';
|
import { IndividualEmbedRunnerOptions } from '@/runners/individualRunner';
|
||||||
import { ProviderRunnerOptions } from '@/runners/runner';
|
import { ProviderRunnerOptions } from '@/runners/runner';
|
||||||
|
|
||||||
|
const SKIP_VALIDATION_CHECK_IDS = [warezcdnembedMp4Scraper.id];
|
||||||
|
|
||||||
export function isValidStream(stream: Stream | undefined): boolean {
|
export function isValidStream(stream: Stream | undefined): boolean {
|
||||||
if (!stream) return false;
|
if (!stream) return false;
|
||||||
if (stream.type === 'hls') {
|
if (stream.type === 'hls') {
|
||||||
|
@ -21,7 +24,10 @@ export function isValidStream(stream: Stream | undefined): boolean {
|
||||||
export async function validatePlayableStream(
|
export async function validatePlayableStream(
|
||||||
stream: Stream,
|
stream: Stream,
|
||||||
ops: ProviderRunnerOptions | IndividualEmbedRunnerOptions,
|
ops: ProviderRunnerOptions | IndividualEmbedRunnerOptions,
|
||||||
|
sourcererId: string,
|
||||||
): Promise<Stream | null> {
|
): Promise<Stream | null> {
|
||||||
|
if (SKIP_VALIDATION_CHECK_IDS.includes(sourcererId)) return stream;
|
||||||
|
|
||||||
if (stream.type === 'hls') {
|
if (stream.type === 'hls') {
|
||||||
const result = await ops.proxiedFetcher.full(stream.playlist, {
|
const result = await ops.proxiedFetcher.full(stream.playlist, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
@ -63,8 +69,11 @@ export async function validatePlayableStream(
|
||||||
export async function validatePlayableStreams(
|
export async function validatePlayableStreams(
|
||||||
streams: Stream[],
|
streams: Stream[],
|
||||||
ops: ProviderRunnerOptions | IndividualEmbedRunnerOptions,
|
ops: ProviderRunnerOptions | IndividualEmbedRunnerOptions,
|
||||||
|
sourcererId: string,
|
||||||
): Promise<Stream[]> {
|
): Promise<Stream[]> {
|
||||||
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,
|
(v) => v !== null,
|
||||||
) as Stream[];
|
) as Stream[];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue