Add lookmovie

This commit is contained in:
Jip Fr
2023-10-01 22:07:37 +02:00
parent 09679b2585
commit bbc4f60c73
7 changed files with 175 additions and 4 deletions

View File

@@ -0,0 +1,31 @@
import { SourcererOutput, makeSourcerer } from '@/providers/base';
import { NotFoundError } from '@/utils/errors';
import { scrape, searchAndFindMedia } from './util';
import { MovieContext, ShowContext } from '../zoechip/common';
async function universalScraper(ctx: ShowContext | MovieContext): Promise<SourcererOutput> {
const lookmovieData = await searchAndFindMedia(ctx.media);
if (!lookmovieData) throw new NotFoundError('Media not found');
const videoUrl = await scrape(ctx.media, lookmovieData);
if (!videoUrl) throw new NotFoundError('No video found');
return {
embeds: [],
stream: {
playlist: videoUrl,
type: 'hls',
flags: [],
},
};
}
export const lookmovieScraper = makeSourcerer({
id: 'lookmovie',
name: 'LookMovie',
rank: 1,
flags: [],
scrapeShow: universalScraper,
scrapeMovie: universalScraper,
});