better error handeling

This commit is contained in:
Pas 2025-03-17 12:12:37 -07:00
parent 9ec5f57e90
commit ce7b80ff4e

View file

@ -16,8 +16,17 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
if (!apiRes) {
throw new NotFoundError('Failed to fetch StreamBox data');
}
const data = await apiRes;
if (data.provider !== 'MovieBox') {
throw new NotFoundError('Not a MovieBox provider response');
}
if (!data.url || data.url.length === 0) {
throw new NotFoundError('No MovieBox streams found');
}
const streams: Record<string, string> = {};
data.url.forEach((stream: any) => {
streams[stream.resulation] = stream.link;