mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-25 19:01:52 +01:00
Merge branch 'dev' of github.com:JamesHawkinss/movie-web into dev
This commit is contained in:
commit
e6d1d2506d
@ -9,6 +9,7 @@ import {
|
|||||||
|
|
||||||
import { CORS_PROXY_URL, OMDB_API_KEY } from "mw_constants";
|
import { CORS_PROXY_URL, OMDB_API_KEY } from "mw_constants";
|
||||||
import { unpack } from "unpacker";
|
import { unpack } from "unpacker";
|
||||||
|
import json5 from "json5";
|
||||||
|
|
||||||
export const gomostreamScraper: MWMediaProvider = {
|
export const gomostreamScraper: MWMediaProvider = {
|
||||||
id: "gomostream",
|
id: "gomostream",
|
||||||
@ -74,18 +75,24 @@ export const gomostreamScraper: MWMediaProvider = {
|
|||||||
'x-token': `${tc.slice(5, 13).split("").reverse().join("")}13574199`
|
'x-token': `${tc.slice(5, 13).split("").reverse().join("")}13574199`
|
||||||
}
|
}
|
||||||
}).then((d) => d.json());
|
}).then((d) => d.json());
|
||||||
|
const embeds = src.filter((url: string) => url.includes('gomo.to'));
|
||||||
|
|
||||||
const embedUrl = src.find((url: string) => url.includes('gomo.to'));
|
// maybe try all embeds in the future
|
||||||
|
const embedUrl = embeds[1];
|
||||||
const res2 = await fetch(`${CORS_PROXY_URL}${embedUrl}`).then((d) => d.text());
|
const res2 = await fetch(`${CORS_PROXY_URL}${embedUrl}`).then((d) => d.text());
|
||||||
|
|
||||||
const res2DOM = new DOMParser().parseFromString(res2, "text/html");
|
const res2DOM = new DOMParser().parseFromString(res2, "text/html");
|
||||||
if (res2DOM.body.innerText === "File was deleted") throw new Error("File was deleted");
|
if (res2DOM.body.innerText === "File was deleted") throw new Error("File was deleted");
|
||||||
|
|
||||||
const script = res2DOM.querySelectorAll("script")[8].innerHTML;
|
const script = Array.from(res2DOM.querySelectorAll("script")).find((s: HTMLScriptElement) => s.innerHTML.includes("eval(function(p,a,c,k,e,d"))?.innerHTML;
|
||||||
const unpacked = unpack(script).split('');
|
if (!script) throw new Error("Could not get packed data")
|
||||||
unpacked.splice(0, 43);
|
|
||||||
const index = unpacked.findIndex((e) => e === '"');
|
const unpacked = unpack(script);
|
||||||
const streamUrl = unpacked.slice(0, index).join('');
|
const rawSources = /sources:(\[.*?\])/.exec(unpacked);
|
||||||
|
if (!rawSources) throw new Error("Could not get rawSources");
|
||||||
|
|
||||||
|
const sources = json5.parse(rawSources[1]);
|
||||||
|
const streamUrl = sources[0].file;
|
||||||
|
|
||||||
const streamType = streamUrl.split('.').at(-1);
|
const streamType = streamUrl.split('.').at(-1);
|
||||||
if (streamType !== "mp4" && streamType !== "m3u8") throw new Error("Unsupported stream type");
|
if (streamType !== "mp4" && streamType !== "m3u8") throw new Error("Unsupported stream type");
|
||||||
|
Loading…
Reference in New Issue
Block a user