1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-21 14:47:41 +01:00
smov/src/lib/index.js

49 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-12-30 20:23:15 +01:00
import lookmovie from './scraper/lookmovie';
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([
lookmovie.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);
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);
2021-12-30 20:23:15 +01:00
default:
return;
}
}
2021-07-20 12:20:56 +02:00
export { findContent, getStreamUrl, getEpisodes }