mirror of
https://github.com/p-stream/providers.git
synced 2026-03-11 17:55:36 +00:00
Update valid.ts
This commit is contained in:
parent
47ec40bfb9
commit
0a6ebbd7ee
1 changed files with 23 additions and 15 deletions
|
|
@ -102,6 +102,7 @@ export async function validatePlayableStream(
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
try {
|
||||||
result = await ops.proxiedFetcher.full(stream.playlist, {
|
result = await ops.proxiedFetcher.full(stream.playlist, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -109,6 +110,9 @@ export async function validatePlayableStream(
|
||||||
...stream.headers,
|
...stream.headers,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.statusCode < 200 || result.statusCode >= 400 || isErrorResponse(result)) return null;
|
if (result.statusCode < 200 || result.statusCode >= 400 || isErrorResponse(result)) return null;
|
||||||
|
|
@ -140,7 +144,8 @@ export async function validatePlayableStream(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ops.proxiedFetcher.full(quality.url, {
|
try {
|
||||||
|
return await ops.proxiedFetcher.full(quality.url, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
...stream.preferredHeaders,
|
...stream.preferredHeaders,
|
||||||
|
|
@ -148,6 +153,9 @@ export async function validatePlayableStream(
|
||||||
Range: 'bytes=0-1',
|
Range: 'bytes=0-1',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
} catch {
|
||||||
|
return { statusCode: 500, body: '', finalUrl: quality.url };
|
||||||
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
// remove invalid qualities from the stream
|
// remove invalid qualities from the stream
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue