mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-25 18:41:49 +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 xemovie from './scraper/xemovie';
|
||||||
import theflix from './scraper/theflix';
|
import theflix from './scraper/theflix';
|
||||||
import vidzstore from './scraper/vidzstore';
|
import vidzstore from './scraper/vidzstore';
|
||||||
import gdriveplayer from './scraper/gdriveplayer';
|
import gdriveplayer from './scraper/gdriveplayer';
|
||||||
|
import gomostream from './scraper/gomostream';
|
||||||
|
|
||||||
async function findContent(searchTerm, type) {
|
async function findContent(searchTerm, type) {
|
||||||
const results = { options: []};
|
const results = { options: []};
|
||||||
const content = await Promise.all([
|
const content = await Promise.all([
|
||||||
theflix.findContent(searchTerm, type),
|
theflix.findContent(searchTerm, type),
|
||||||
|
gomostream.findContent(searchTerm, type),
|
||||||
gdriveplayer.findContent(searchTerm, type),
|
gdriveplayer.findContent(searchTerm, type),
|
||||||
xemovie.findContent(searchTerm, type),
|
xemovie.findContent(searchTerm, type),
|
||||||
vidzstore.findContent(searchTerm, type),
|
vidzstore.findContent(searchTerm, type),
|
||||||
@ -27,8 +28,6 @@ async function findContent(searchTerm, type) {
|
|||||||
|
|
||||||
async function getStreamUrl(slug, type, source, season, episode) {
|
async function getStreamUrl(slug, type, source, season, episode) {
|
||||||
switch (source) {
|
switch (source) {
|
||||||
case 'lookmovie':
|
|
||||||
return await lookmovie.getStreamUrl(slug, type, season, episode);
|
|
||||||
case 'theflix':
|
case 'theflix':
|
||||||
return await theflix.getStreamUrl(slug, type, season, episode);
|
return await theflix.getStreamUrl(slug, type, season, episode);
|
||||||
case 'vidzstore':
|
case 'vidzstore':
|
||||||
@ -37,6 +36,8 @@ async function getStreamUrl(slug, type, source, season, episode) {
|
|||||||
return await xemovie.getStreamUrl(slug, type, season, episode);
|
return await xemovie.getStreamUrl(slug, type, season, episode);
|
||||||
case 'gdriveplayer':
|
case 'gdriveplayer':
|
||||||
return await gdriveplayer.getStreamUrl(slug, type, season, episode);
|
return await gdriveplayer.getStreamUrl(slug, type, season, episode);
|
||||||
|
case 'gomostream':
|
||||||
|
return await gomostream.getStreamUrl(slug, type, season, episode);
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -44,8 +45,6 @@ async function getStreamUrl(slug, type, source, season, episode) {
|
|||||||
|
|
||||||
async function getEpisodes(slug, source) {
|
async function getEpisodes(slug, source) {
|
||||||
switch (source) {
|
switch (source) {
|
||||||
case 'lookmovie':
|
|
||||||
return await lookmovie.getEpisodes(slug);
|
|
||||||
case 'theflix':
|
case 'theflix':
|
||||||
return await theflix.getEpisodes(slug);
|
return await theflix.getEpisodes(slug);
|
||||||
case 'xemovie':
|
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`;
|
const BASE_URL = `${process.env.REACT_APP_CORS_PROXY_URL}https://stream.vidzstore.com`;
|
||||||
|
|
||||||
async function findContent(searchTerm, type) {
|
async function findContent(searchTerm, type) {
|
||||||
@ -22,7 +24,34 @@ async function findContent(searchTerm, type) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return { options: results };
|
const fuse = new Fuse(results, { threshold: 0.3, keys: ["title"] });
|
||||||
|
const matchedResults = fuse
|
||||||
|
.search(searchTerm)
|
||||||
|
.map(result => result.item);
|
||||||
|
|
||||||
|
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 {
|
} catch {
|
||||||
return { options: [] };
|
return { options: [] };
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user