add disabled embed filter

This commit is contained in:
Jorrin
2024-01-07 00:42:32 +01:00
parent 53ed51013c
commit b5b2d341f9
2 changed files with 10 additions and 2 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "@movie-web/providers",
"version": "1.1.5",
"version": "2.0.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@movie-web/providers",
"version": "1.1.5",
"version": "2.0.5",
"license": "MIT",
"dependencies": {
"cheerio": "^1.0.0-rc.12",

View File

@@ -58,6 +58,14 @@ export async function scrapeInvidualSource(
}
if (!output) throw new Error('output is null');
// filter output with only valid embeds that are not disabled
output.embeds = output.embeds.filter((embed) => {
const e = list.embeds.find((v) => v.id === embed.embedId);
if (!e || e.disabled) return false;
return true;
});
if ((!output.stream || output.stream.length === 0) && output.embeds.length === 0)
throw new NotFoundError('No streams found');
return output;