mirror of
https://github.com/movie-web/movie-web.git
synced 2024-11-10 23:55:05 +01:00
Merge branch 'v3' of https://github.com/JamesHawkinss/movie-web into v3
This commit is contained in:
commit
b6ff4bf800
@ -3,8 +3,8 @@ import { initializeScraperStore } from "./helpers/register";
|
||||
// providers
|
||||
import "./providers/gdriveplayer";
|
||||
import "./providers/flixhq";
|
||||
import "./providers/superstream";
|
||||
import "./providers/gomostream";
|
||||
import "./providers/superstream/superstream";
|
||||
|
||||
// embeds
|
||||
// -- nothing here yet
|
||||
|
@ -96,6 +96,16 @@ const get = (data: object, altApi = false) => {
|
||||
});
|
||||
};
|
||||
|
||||
// Find best resolution
|
||||
const getBestQuality = (list: any[]) => {
|
||||
return (
|
||||
list.find((quality: any) => quality.quality === "1080p" && quality.path) ??
|
||||
list.find((quality: any) => quality.quality === "720p" && quality.path) ??
|
||||
list.find((quality: any) => quality.quality === "480p" && quality.path) ??
|
||||
list.find((quality: any) => quality.quality === "360p" && quality.path)
|
||||
);
|
||||
};
|
||||
|
||||
registerProvider({
|
||||
id: "superstream",
|
||||
displayName: "Superstream",
|
||||
@ -136,19 +146,7 @@ registerProvider({
|
||||
const mediaRes = (await get(apiQuery)).data;
|
||||
progress(50);
|
||||
|
||||
const hdQuality =
|
||||
mediaRes.list.find(
|
||||
(quality: any) => quality.quality === "1080p" && quality.path
|
||||
) ??
|
||||
mediaRes.list.find(
|
||||
(quality: any) => quality.quality === "720p" && quality.path
|
||||
) ??
|
||||
mediaRes.list.find(
|
||||
(quality: any) => quality.quality === "480p" && quality.path
|
||||
) ??
|
||||
mediaRes.list.find(
|
||||
(quality: any) => quality.quality === "360p" && quality.path
|
||||
);
|
||||
const hdQuality = getBestQuality(mediaRes.list);
|
||||
|
||||
if (!hdQuality) throw new Error("No quality could be found.");
|
||||
|
||||
@ -206,19 +204,7 @@ registerProvider({
|
||||
const mediaRes = (await get(apiQuery)).data;
|
||||
progress(66);
|
||||
|
||||
const hdQuality =
|
||||
mediaRes.list.find(
|
||||
(quality: any) => quality.quality === "1080p" && quality.path
|
||||
) ??
|
||||
mediaRes.list.find(
|
||||
(quality: any) => quality.quality === "720p" && quality.path
|
||||
) ??
|
||||
mediaRes.list.find(
|
||||
(quality: any) => quality.quality === "480p" && quality.path
|
||||
) ??
|
||||
mediaRes.list.find(
|
||||
(quality: any) => quality.quality === "360p" && quality.path
|
||||
);
|
||||
const hdQuality = getBestQuality(mediaRes.list);
|
||||
|
||||
if (!hdQuality) throw new Error("No quality could be found.");
|
||||
|
Loading…
Reference in New Issue
Block a user