mirror of
https://github.com/p-stream/providers.git
synced 2026-01-11 20:10:33 +00:00
add disabled embed filter
This commit is contained in:
parent
53ed51013c
commit
b5b2d341f9
2 changed files with 10 additions and 2 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue