mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 13:33:25 +00:00
fix scraper crashing if an embed is not playable
This commit is contained in:
@@ -151,6 +151,9 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
|
|||||||
if (embedOutput.stream.length === 0) {
|
if (embedOutput.stream.length === 0) {
|
||||||
throw new NotFoundError('No streams found');
|
throw new NotFoundError('No streams found');
|
||||||
}
|
}
|
||||||
|
const playableStream = await validatePlayableStream(embedOutput.stream[0], ops);
|
||||||
|
if (!playableStream) throw new NotFoundError('No streams found');
|
||||||
|
embedOutput.stream = [playableStream];
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const updateParams: UpdateEvent = {
|
const updateParams: UpdateEvent = {
|
||||||
id: source.id,
|
id: source.id,
|
||||||
@@ -163,13 +166,11 @@ export async function runAllProviders(list: ProviderList, ops: ProviderRunnerOpt
|
|||||||
ops.events?.update?.(updateParams);
|
ops.events?.update?.(updateParams);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const playableStream = await validatePlayableStream(embedOutput.stream[0], ops);
|
|
||||||
if (!playableStream) throw new NotFoundError('No streams found');
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sourceId: source.id,
|
sourceId: source.id,
|
||||||
embedId: scraper.id,
|
embedId: scraper.id,
|
||||||
stream: playableStream,
|
stream: embedOutput.stream[0],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user