From 301c9200ad2c92aec44f2ba27f41094f15ba15e5 Mon Sep 17 00:00:00 2001 From: TPN Date: Fri, 5 Apr 2024 17:41:43 +0000 Subject: [PATCH 1/2] fix ridomovies search --- src/providers/sources/ridomovies/index.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/providers/sources/ridomovies/index.ts b/src/providers/sources/ridomovies/index.ts index 1fa7659..69fb745 100644 --- a/src/providers/sources/ridomovies/index.ts +++ b/src/providers/sources/ridomovies/index.ts @@ -19,13 +19,19 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) => q: ctx.media.title, }, }); - const show = searchResult.data.items[0]; - if (!show) throw new NotFoundError('No watchable item found'); + const mediaData = searchResult.data.items.map((movieEl) => { + const name = movieEl.title; + const year = movieEl.contentable.releaseYear; + const fullSlug = movieEl.fullSlug; + return { name, year, fullSlug }; + }); + const targetMedia = mediaData.find((m) => m.name === ctx.media.title); + if (!targetMedia?.fullSlug) throw new NotFoundError('No watchable item found'); - let iframeSourceUrl = `/${show.fullSlug}/videos`; + let iframeSourceUrl = `/${targetMedia.fullSlug}/videos`; if (ctx.media.type === 'show') { - const showPageResult = await ctx.proxiedFetcher(`/${show.fullSlug}`, { + const showPageResult = await ctx.proxiedFetcher(`/${targetMedia.fullSlug}`, { baseUrl: ridoMoviesBase, }); const fullEpisodeSlug = `season-${ctx.media.season.number}/episode-${ctx.media.episode.number}`; From 718eb97c06dbeaf5ef0c900d0c6cbb3e3f48e76f Mon Sep 17 00:00:00 2001 From: TPN Date: Fri, 5 Apr 2024 23:28:49 +0530 Subject: [PATCH 2/2] check year --- src/providers/sources/ridomovies/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/sources/ridomovies/index.ts b/src/providers/sources/ridomovies/index.ts index 69fb745..638ea13 100644 --- a/src/providers/sources/ridomovies/index.ts +++ b/src/providers/sources/ridomovies/index.ts @@ -25,7 +25,7 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) => const fullSlug = movieEl.fullSlug; return { name, year, fullSlug }; }); - const targetMedia = mediaData.find((m) => m.name === ctx.media.title); + const targetMedia = mediaData.find((m) => m.name === ctx.media.title && m.year === ctx.media.releaseYear.toString()); if (!targetMedia?.fullSlug) throw new NotFoundError('No watchable item found'); let iframeSourceUrl = `/${targetMedia.fullSlug}/videos`;