skip validation check for warezcdnmp4

This commit is contained in:
Jorrin
2024-04-11 20:42:37 +02:00
parent ef600dd08c
commit 94bfcd0c31
4 changed files with 16 additions and 6 deletions

View File

@@ -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<Stream | null> {
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<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,
) as Stream[];
}