Skip to content

Commit

Permalink
Merge pull request #145 from ztpn/rido
Browse files Browse the repository at this point in the history
fix ridomovies search
  • Loading branch information
JorrinKievit authored Apr 5, 2024
2 parents a6667ad + 718eb97 commit 3ae517c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/providers/sources/ridomovies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 && m.year === ctx.media.releaseYear.toString());
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<string>(`/${show.fullSlug}`, {
const showPageResult = await ctx.proxiedFetcher<string>(`/${targetMedia.fullSlug}`, {
baseUrl: ridoMoviesBase,
});
const fullEpisodeSlug = `season-${ctx.media.season.number}/episode-${ctx.media.episode.number}`;
Expand Down

0 comments on commit 3ae517c

Please sign in to comment.