mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 15:33:26 +00:00
fix ridomovies search
This commit is contained in:
@@ -19,13 +19,19 @@ const universalScraper = async (ctx: MovieScrapeContext | ShowScrapeContext) =>
|
|||||||
q: ctx.media.title,
|
q: ctx.media.title,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const show = searchResult.data.items[0];
|
const mediaData = searchResult.data.items.map((movieEl) => {
|
||||||
if (!show) throw new NotFoundError('No watchable item found');
|
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') {
|
if (ctx.media.type === 'show') {
|
||||||
const showPageResult = await ctx.proxiedFetcher<string>(`/${show.fullSlug}`, {
|
const showPageResult = await ctx.proxiedFetcher<string>(`/${targetMedia.fullSlug}`, {
|
||||||
baseUrl: ridoMoviesBase,
|
baseUrl: ridoMoviesBase,
|
||||||
});
|
});
|
||||||
const fullEpisodeSlug = `season-${ctx.media.season.number}/episode-${ctx.media.episode.number}`;
|
const fullEpisodeSlug = `season-${ctx.media.season.number}/episode-${ctx.media.episode.number}`;
|
||||||
|
Reference in New Issue
Block a user