mirror of
https://github.com/sussy-code/providers.git
synced 2026-03-28 13:38:42 +00:00
Removed test comment changed search url
This commit is contained in:
parent
36d70fa6fd
commit
e962bb410f
3 changed files with 3550 additions and 7 deletions
3535
pnpm-lock.yaml
Normal file
3535
pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue