mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-10 23:35:08 +01:00
Fix searching on vidzstore, reimplement gomostream
This commit is contained in:
parent
3ac420ef6f
commit
25094e3d9c
@ -1,13 +1,14 @@
|
||||
import lookmovie from './scraper/lookmovie';
|
||||
import xemovie from './scraper/xemovie';
|
||||
import theflix from './scraper/theflix';
|
||||
import vidzstore from './scraper/vidzstore';
|
||||
import gdriveplayer from './scraper/gdriveplayer';
|
||||
import gomostream from './scraper/gomostream';
|
||||
|
||||
async function findContent(searchTerm, type) {
|
||||
const results = { options: []};
|
||||
const content = await Promise.all([
|
||||
theflix.findContent(searchTerm, type),
|
||||
gomostream.findContent(searchTerm, type),
|
||||
gdriveplayer.findContent(searchTerm, type),
|
||||
xemovie.findContent(searchTerm, type),
|
||||
vidzstore.findContent(searchTerm, type),
|
||||
@ -27,8 +28,6 @@ async function findContent(searchTerm, type) {
|
||||
|
||||
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':
|
||||
@ -37,6 +36,8 @@ async function getStreamUrl(slug, type, source, season, episode) {
|
||||
return await xemovie.getStreamUrl(slug, type, season, episode);
|
||||
case 'gdriveplayer':
|
||||
return await gdriveplayer.getStreamUrl(slug, type, season, episode);
|
||||
case 'gomostream':
|
||||
return await gomostream.getStreamUrl(slug, type, season, episode);
|
||||
default:
|
||||
return;
|
||||
}
|
||||
@ -44,8 +45,6 @@ async function getStreamUrl(slug, type, source, season, episode) {
|
||||
|
||||
async function getEpisodes(slug, source) {
|
||||
switch (source) {
|
||||
case 'lookmovie':
|
||||
return await lookmovie.getEpisodes(slug);
|
||||
case 'theflix':
|
||||
return await theflix.getEpisodes(slug);
|
||||
case 'xemovie':
|
||||
|
@ -1,3 +1,5 @@
|
||||
import Fuse from 'fuse.js'
|
||||
|
||||
const BASE_URL = `${process.env.REACT_APP_CORS_PROXY_URL}https://stream.vidzstore.com`;
|
||||
|
||||
async function findContent(searchTerm, type) {
|
||||
@ -21,8 +23,35 @@ async function findContent(searchTerm, type) {
|
||||
source: "vidzstore",
|
||||
}
|
||||
});
|
||||
|
||||
const fuse = new Fuse(results, { threshold: 0.3, keys: ["title"] });
|
||||
const matchedResults = fuse
|
||||
.search(searchTerm)
|
||||
.map(result => result.item);
|
||||
|
||||
return { options: results };
|
||||
if (matchedResults.length === 0) {
|
||||
return { options: [] };
|
||||
}
|
||||
|
||||
if (matchedResults.length > 1) {
|
||||
const res = { options: [] };
|
||||
|
||||
matchedResults.forEach((r) => res.options.push({
|
||||
title: r.title,
|
||||
slug: r.slug,
|
||||
type: r.type,
|
||||
year: r.year,
|
||||
source: 'vidzstore'
|
||||
}));
|
||||
|
||||
return res;
|
||||
} else {
|
||||
const { title, slug, type, year } = matchedResults[0];
|
||||
|
||||
return {
|
||||
options: [{ title, slug, type, year, source: 'vidzstore' }]
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
return { options: [] };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user