sudo-archive/src/lib/index.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-07-26 12:59:17 +00:00
import lookMovie from './scraper/lookmovie';
import gomostream from './scraper/gomostream';
2021-07-20 10:20:56 +00:00
async function findContent(searchTerm, type) {
2021-07-20 22:49:33 +00:00
const results = { options: []};
const content = await Promise.all([
lookMovie.findContent(searchTerm, type),
gomostream.findContent(searchTerm, type)
]);
content.forEach((o) => {
if (!o || !o.options) return;
o.options.forEach((i) => {
if (!i) return;
results.options.push(i)
})
});
return results;
2021-07-20 10:20:56 +00:00
}
2021-07-20 22:49:33 +00:00
async function getStreamUrl(slug, type, source, season, episode) {
switch (source) {
case 'lookmovie':
return await lookMovie.getStreamUrl(slug, type, season, episode);
case 'gomostream':
return await gomostream.getStreamUrl(slug, type, season, episode);
default:
return;
}
2021-07-20 10:20:56 +00:00
}
2021-07-20 22:49:33 +00:00
async function getEpisodes(slug, source) {
switch (source) {
case 'lookmovie':
return await lookMovie.getEpisodes(slug);
case 'gomostream':
default:
return;
}
2021-07-20 10:20:56 +00:00
}
export { findContent, getStreamUrl, getEpisodes }