mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-14 09:05:06 +01:00
56 lines
1.6 KiB
JavaScript
56 lines
1.6 KiB
JavaScript
import lookmovie from './scraper/lookmovie';
|
|
import xemovie from './scraper/xemovie';
|
|
import theflix from './scraper/theflix';
|
|
import vidzstore from './scraper/vidzstore';
|
|
|
|
async function findContent(searchTerm, type) {
|
|
const results = { options: []};
|
|
const content = await Promise.all([
|
|
// lookmovie.findContent(searchTerm, type),
|
|
xemovie.findContent(searchTerm, type),
|
|
theflix.findContent(searchTerm, type),
|
|
vidzstore.findContent(searchTerm, type)
|
|
]);
|
|
|
|
content.forEach((o) => {
|
|
if (!o || !o.options) return;
|
|
|
|
o.options.forEach((i) => {
|
|
if (!i) return;
|
|
results.options.push(i)
|
|
})
|
|
});
|
|
|
|
return results;
|
|
}
|
|
|
|
async function getStreamUrl(slug, type, source, season, episode) {
|
|
switch (source) {
|
|
case 'lookmovie':
|
|
return await lookmovie.getStreamUrl(slug, type, season, episode);
|
|
case 'theflix':
|
|
return await theflix.getStreamUrl(slug, type, season, episode);
|
|
case 'vidzstore':
|
|
return await vidzstore.getStreamUrl(slug);
|
|
case 'xemovie':
|
|
return await xemovie.getStreamUrl(slug, type, season, episode);
|
|
default:
|
|
return;
|
|
}
|
|
}
|
|
|
|
async function getEpisodes(slug, source) {
|
|
switch (source) {
|
|
case 'lookmovie':
|
|
return await lookmovie.getEpisodes(slug);
|
|
case 'theflix':
|
|
return await theflix.getEpisodes(slug);
|
|
case 'xemovie':
|
|
return await xemovie.getEpisodes(slug);
|
|
default:
|
|
return;
|
|
}
|
|
}
|
|
|
|
export { findContent, getStreamUrl, getEpisodes }
|