mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 18:13:25 +00:00
Add lookmovie
This commit is contained in:
31
src/providers/sources/lookmovie/index.ts
Normal file
31
src/providers/sources/lookmovie/index.ts
Normal 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,
|
||||
});
|
Reference in New Issue
Block a user