mirror of
https://github.com/sussy-code/providers.git
synced 2026-08-15 03:34:13 +00:00
better error handling uira.live
This commit is contained in:
parent
a93761822f
commit
b555f6c772
1 changed files with 17 additions and 5 deletions
|
|
@ -11,21 +11,33 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
ctx.media.type === 'movie' ? '' : `?s=${ctx.media.season.number}&e=${ctx.media.episode.number}`
|
||||
}`;
|
||||
|
||||
let result = await ctx.fetcher(fetchUrl);
|
||||
let result;
|
||||
try {
|
||||
result = await ctx.fetcher(fetchUrl);
|
||||
} catch (e: any) {
|
||||
if (e instanceof NotFoundError) throw new NotFoundError(`uiralive: ${e.message}`);
|
||||
throw e;
|
||||
}
|
||||
|
||||
if (!result?.sources || result.sources.length === 0) {
|
||||
if (!result) {
|
||||
try {
|
||||
result = await ctx.fetcher(fetchUrl);
|
||||
} catch (e: any) {
|
||||
if (e instanceof NotFoundError) throw new NotFoundError(e.message);
|
||||
if (e instanceof NotFoundError) throw new NotFoundError(`uiralive: ${e.message}`);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
if (!result?.sources || result.sources.length === 0) throw new NotFoundError('No sources found');
|
||||
if (!result || !result.sources || result.sources.length === 0) {
|
||||
throw new NotFoundError('uiralive: No sources found');
|
||||
}
|
||||
|
||||
ctx.progress(90);
|
||||
|
||||
if (!result.sources[0].url) {
|
||||
throw new Error('uiralive: Source URL is missing');
|
||||
}
|
||||
|
||||
return {
|
||||
embeds: [],
|
||||
stream: [
|
||||
|
|
@ -34,7 +46,7 @@ async function comboScraper(ctx: ShowScrapeContext | MovieScrapeContext): Promis
|
|||
playlist: result.sources[0].url,
|
||||
type: 'hls',
|
||||
flags: [flags.CORS_ALLOWED],
|
||||
captions: [],
|
||||
captions: result.captions || [],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue