mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 08:13:24 +00:00
Compare commits
3 Commits
8281c3141a
...
feature/fi
Author | SHA1 | Date | |
---|---|---|---|
|
7cb4686e02 | ||
|
3b00d6ffc8 | ||
|
2f4e76747d |
@@ -1,8 +1,6 @@
|
||||
import { load } from 'cheerio';
|
||||
import { unpack } from 'unpacker';
|
||||
|
||||
import { flags } from '@/entrypoint/utils/targets';
|
||||
|
||||
import { SubtitleResult } from './types';
|
||||
import { makeEmbed } from '../../base';
|
||||
import { Caption, getCaptionTypeFromUrl, labelToLanguageCode } from '../../captions';
|
||||
|
@@ -59,12 +59,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;
|
||||
});
|
||||
// filter output with only valid embeds that are not disabled, and remove duplicates
|
||||
output.embeds = output.embeds
|
||||
.filter((embed) => {
|
||||
const e = list.embeds.find((v) => v.id === embed.embedId);
|
||||
if (!e || e.disabled) return false;
|
||||
return true;
|
||||
})
|
||||
.filter((v, i, a) => a.findIndex((t) => t.embedId === v.embedId) === i);
|
||||
|
||||
if ((!output.stream || output.stream.length === 0) && output.embeds.length === 0)
|
||||
throw new NotFoundError('No streams found');
|
||||
|
@@ -112,12 +112,13 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
|
||||
};
|
||||
}
|
||||
|
||||
// filter disabled and run embed scrapers on listed embeds
|
||||
// filter disabled, filter out duplicates, run embed scrapers on listed embeds
|
||||
const sortedEmbeds = output.embeds
|
||||
.filter((embed) => {
|
||||
const e = list.embeds.find((v) => v.id === embed.embedId);
|
||||
return e && !e.disabled;
|
||||
})
|
||||
.filter((v, i, a) => a.findIndex((t) => t.embedId === v.embedId) === i)
|
||||
.sort((a, b) => embedIds.indexOf(a.embedId) - embedIds.indexOf(b.embedId));
|
||||
|
||||
if (sortedEmbeds.length > 0) {
|
||||
|
Reference in New Issue
Block a user