mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 16:43:25 +00:00
Removed test comment changed search url
This commit is contained in:
@@ -9,7 +9,6 @@ async function universalScraper(ctx: ShowContext | MovieContext): Promise<Source
|
||||
if (!lookmovieData) throw new NotFoundError('Media not found');
|
||||
|
||||
ctx.progress(30);
|
||||
//test
|
||||
const videoUrl = await scrape(ctx.media, lookmovieData);
|
||||
if (!videoUrl) throw new NotFoundError('No video found');
|
||||
|
||||
|
@@ -8,12 +8,21 @@ import { Result } from './type';
|
||||
import { getVideoUrl } from './video';
|
||||
|
||||
export async function searchAndFindMedia(media: MovieMedia | ShowMedia): Promise<Result | undefined> {
|
||||
const searchRes = await fetch(
|
||||
`https://lookmovie2.to/api/v1/${media.type}s/do-search/?q=${encodeURIComponent(media.title)}`,
|
||||
).then((d) => d.json());
|
||||
const results = searchRes.result;
|
||||
const result = results.find((res: Result) => compareMedia(media, res.title, Number(res.year)));
|
||||
return result;
|
||||
if (media.type === "show") {
|
||||
const searchRes = await fetch(`https://lmscript.xyz/v1/shows?filters[q]=${encodeURIComponent(media.title)}`).then((d) => d.json());
|
||||
|
||||
const results = searchRes.result;
|
||||
const result = results.find((res: Result) => compareMedia(media, res.title, Number(res.year)));
|
||||
return result;
|
||||
} else if (media.type === "movie") {
|
||||
const searchRes = await fetch(`https://lmscript.xyz/v1/movies?filters[q]=${encodeURIComponent(media.title)}`).then((d) => d.json());
|
||||
|
||||
const results = searchRes.items;
|
||||
const result = results.find((res: Result) => compareMedia(media, res.title, Number(res.year)));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
export async function scrape(media: MovieMedia | ShowMedia, result: Result) {
|
||||
|
Reference in New Issue
Block a user