1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-22 14:57:40 +01:00
smov/src2/lib/index.js

56 lines
1.6 KiB
JavaScript
Raw Normal View History

2021-12-30 20:23:15 +01:00
import lookmovie from './scraper/lookmovie';
import xemovie from './scraper/xemovie';
2021-12-30 20:23:15 +01:00
import theflix from './scraper/theflix';
2022-01-30 19:45:32 +01:00
import vidzstore from './scraper/vidzstore';
2021-12-30 20:23:15 +01:00
async function findContent(searchTerm, type) {
const results = { options: []};
const content = await Promise.all([
2022-01-30 21:33:12 +01:00
// lookmovie.findContent(searchTerm, type),
xemovie.findContent(searchTerm, type),
2022-01-30 19:45:32 +01:00
theflix.findContent(searchTerm, type),
vidzstore.findContent(searchTerm, type)
2021-12-30 20:23:15 +01:00
]);
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);
2022-01-30 19:45:32 +01:00
case 'vidzstore':
return await vidzstore.getStreamUrl(slug);
case 'xemovie':
return await xemovie.getStreamUrl(slug, type, season, episode);
2021-12-30 20:23:15 +01:00
default:
return;
}
}
async function getEpisodes(slug, source) {
switch (source) {
case 'lookmovie':
return await lookmovie.getEpisodes(slug);
2021-12-30 21:54:45 +01:00
case 'theflix':
return await theflix.getEpisodes(slug);
case 'xemovie':
return await xemovie.getEpisodes(slug);
2021-12-30 20:23:15 +01:00
default:
return;
}
}
2022-01-30 21:33:12 +01:00
export { findContent, getStreamUrl, getEpisodes }