mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-24 04:31:51 +01:00
fix linting
This commit is contained in:
parent
ec6e145f82
commit
62220532d7
@ -54,7 +54,6 @@ export async function getMetaFromId(
|
||||
throw err;
|
||||
}
|
||||
|
||||
console.log(data.external_ids);
|
||||
const imdbId = data.external_ids.find(
|
||||
(v) => v.provider === "imdb_latest"
|
||||
)?.external_id;
|
||||
|
@ -1,98 +0,0 @@
|
||||
import { unpack } from "unpacker";
|
||||
import { proxiedFetch } from "../helpers/fetch";
|
||||
import { registerProvider } from "../helpers/register";
|
||||
import { MWStreamQuality, MWStreamType } from "../helpers/streams";
|
||||
import { MWMediaType } from "../metadata/types";
|
||||
import json5 from "json5";
|
||||
|
||||
const gomoBase = "https://gomo.to/";
|
||||
|
||||
registerProvider({
|
||||
id: "gomostream",
|
||||
displayName: "gomostream",
|
||||
rank: 999,
|
||||
type: [MWMediaType.MOVIE],
|
||||
|
||||
async scrape({ media, progress }) {
|
||||
// get movie from gomostream
|
||||
const contentResult = await proxiedFetch<any>(
|
||||
`/${media.meta.type}/${media.imdbId}`,
|
||||
{
|
||||
baseURL: gomoBase,
|
||||
}
|
||||
);
|
||||
|
||||
// movie doesn't exist
|
||||
if (
|
||||
contentResult === "Movie not available." ||
|
||||
contentResult === "Episode not available."
|
||||
)
|
||||
throw new Error("No watchable item found.");
|
||||
|
||||
// decode stream
|
||||
progress(25);
|
||||
|
||||
const tc = contentResult.match(/var tc = '(.+)';/)?.[1] || "";
|
||||
const _token = contentResult.match(/"_token": "(.+)",/)?.[1] || "";
|
||||
|
||||
const fd = new FormData();
|
||||
fd.append("tokenCode", tc);
|
||||
fd.append("_token", _token);
|
||||
|
||||
const src = await proxiedFetch<any>(`/decoding_v3.php`, {
|
||||
baseURL: gomoBase,
|
||||
method: "POST",
|
||||
body: fd,
|
||||
headers: {
|
||||
"x-token": `${tc.slice(5, 13).split("").reverse().join("")}13574199`,
|
||||
},
|
||||
parseResponse: JSON.parse,
|
||||
});
|
||||
|
||||
// TODO should check all embed urls in future
|
||||
const embedUrl = src.filter((url: string) => url.includes("gomo.to"))[1];
|
||||
|
||||
// get stream info
|
||||
progress(50);
|
||||
|
||||
const streamRes = await proxiedFetch<any>(embedUrl);
|
||||
|
||||
const streamResDom = new DOMParser().parseFromString(
|
||||
streamRes,
|
||||
"text/html"
|
||||
);
|
||||
if (streamResDom.body.innerText === "File was deleted")
|
||||
throw new Error("No watchable item found.");
|
||||
|
||||
const script = Array.from(streamResDom.querySelectorAll("script")).find(
|
||||
(s: HTMLScriptElement) =>
|
||||
s.innerHTML.includes("eval(function(p,a,c,k,e,d")
|
||||
)?.innerHTML;
|
||||
if (!script) throw new Error("Could not get packed data");
|
||||
|
||||
// unpack data
|
||||
progress(75);
|
||||
|
||||
const unpacked = unpack(script);
|
||||
const rawSources = /sources:(\[.*?\])/.exec(unpacked);
|
||||
if (!rawSources) throw new Error("Could not get stream URL");
|
||||
|
||||
const sources = json5.parse(rawSources[1]);
|
||||
const streamUrl = sources[0].file;
|
||||
|
||||
console.log(sources);
|
||||
|
||||
const streamType = streamUrl.split(".").at(-1);
|
||||
if (streamType !== "mp4" && streamType !== "m3u8")
|
||||
throw new Error("Unsupported stream type");
|
||||
|
||||
return {
|
||||
embeds: [],
|
||||
stream: {
|
||||
quality: streamType,
|
||||
streamUrl: streamUrl,
|
||||
type: streamType,
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
@ -1,13 +1,11 @@
|
||||
import { registerProvider } from "@/backend/helpers/register";
|
||||
import { MWMediaType } from "@/backend/metadata/types";
|
||||
import { conf } from "@/setup/config";
|
||||
|
||||
import { customAlphabet } from "nanoid";
|
||||
// import toWebVTT from "srt-webvtt";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { proxiedFetch } from "@/backend/helpers/fetch";
|
||||
import { MWStreamQuality, MWStreamType } from "@/backend/helpers/streams";
|
||||
import { MetadataSchema } from "hls.js";
|
||||
|
||||
const nanoid = customAlphabet("0123456789abcdef", 32);
|
||||
|
||||
@ -154,8 +152,6 @@ registerProvider({
|
||||
|
||||
if (!hdQuality) throw new Error("No quality could be found.");
|
||||
|
||||
console.log(hdQuality);
|
||||
|
||||
// const subtitleApiQuery = {
|
||||
// fid: hdQuality.fid,
|
||||
// uid: "",
|
||||
|
Loading…
Reference in New Issue
Block a user