From afb261717d67b29120c329f48c8d070549040017 Mon Sep 17 00:00:00 2001 From: lonelil <51315646+lonelil@users.noreply.github.com> Date: Wed, 13 Mar 2024 08:34:23 +0800 Subject: [PATCH] complete requested changes --- src/providers/sources/hdrezka/index.ts | 6 +++--- src/providers/sources/hdrezka/types.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/providers/sources/hdrezka/index.ts b/src/providers/sources/hdrezka/index.ts index c98869f..f3de725 100644 --- a/src/providers/sources/hdrezka/index.ts +++ b/src/providers/sources/hdrezka/index.ts @@ -72,7 +72,7 @@ async function getStream( return JSON.parse(response); } -async function getTranslator( +async function getTranslatorId( url: string, id: string, ctx: ShowScrapeContext | MovieScrapeContext, @@ -94,9 +94,9 @@ async function getTranslator( const universalScraper = async (ctx: ShowScrapeContext | MovieScrapeContext): Promise => { 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'); const { url: streamUrl, subtitle: streamSubtitle } = await getStream(result.id, translatorId, ctx); diff --git a/src/providers/sources/hdrezka/types.ts b/src/providers/sources/hdrezka/types.ts index 66b2b9c..d7ccdc2 100644 --- a/src/providers/sources/hdrezka/types.ts +++ b/src/providers/sources/hdrezka/types.ts @@ -13,7 +13,7 @@ export type VideoLinks = { }; export interface MovieData { - id: string; + id: string | null; year: number; type: ScrapeMedia['type']; url: string;