complete requested changes

This commit is contained in:
lonelil
2024-03-13 08:34:23 +08:00
parent 59e1700ea1
commit afb261717d
2 changed files with 4 additions and 4 deletions

View File

@@ -72,7 +72,7 @@ async function getStream(
return JSON.parse(response); return JSON.parse(response);
} }
async function getTranslator( async function getTranslatorId(
url: string, url: string,
id: string, id: string,
ctx: ShowScrapeContext | MovieScrapeContext, ctx: ShowScrapeContext | MovieScrapeContext,
@@ -94,9 +94,9 @@ async function getTranslator(
const universalScraper = async (ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> => { const universalScraper = async (ctx: ShowScrapeContext | MovieScrapeContext): Promise<SourcererOutput> => {
const result = await searchAndFindMediaId(ctx); const result = await searchAndFindMediaId(ctx);
if (!result) throw new NotFoundError('No result found'); if (!result || !result.id) throw new NotFoundError('No result found');
const translatorId = await getTranslator(result.url, result.id, ctx); const translatorId = await getTranslatorId(result.url, result.id, ctx);
if (!translatorId) throw new NotFoundError('No translator id found'); if (!translatorId) throw new NotFoundError('No translator id found');
const { url: streamUrl, subtitle: streamSubtitle } = await getStream(result.id, translatorId, ctx); const { url: streamUrl, subtitle: streamSubtitle } = await getStream(result.id, translatorId, ctx);

View File

@@ -13,7 +13,7 @@ export type VideoLinks = {
}; };
export interface MovieData { export interface MovieData {
id: string; id: string | null;
year: number; year: number;
type: ScrapeMedia['type']; type: ScrapeMedia['type'];
url: string; url: string;