sudo-archive/src/lib/index.js

45 lines
1.2 KiB
JavaScript
Raw Normal View History

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