mirror of
https://github.com/movie-web/movie-web.git
synced 2024-12-24 18:51:53 +01:00
Add gdriveplayer source
This source is temperamental at best, and captions no longer work. We should remove it when we have some more reliable options.
This commit is contained in:
parent
1336a0f12c
commit
6a737396c3
@ -8,8 +8,9 @@
|
|||||||
"@testing-library/jest-dom": "^5.11.4",
|
"@testing-library/jest-dom": "^5.11.4",
|
||||||
"@testing-library/react": "^11.1.0",
|
"@testing-library/react": "^11.1.0",
|
||||||
"@testing-library/user-event": "^12.1.10",
|
"@testing-library/user-event": "^12.1.10",
|
||||||
|
"@types/crypto-js": "^4.1.1",
|
||||||
"@types/react-router": "^5.1.18",
|
"@types/react-router": "^5.1.18",
|
||||||
"crypto-js": "^4.0.0",
|
"crypto-js": "^4.1.1",
|
||||||
"fuse.js": "^6.4.6",
|
"fuse.js": "^6.4.6",
|
||||||
"hls.js": "^1.0.7",
|
"hls.js": "^1.0.7",
|
||||||
"json5": "^2.2.0",
|
"json5": "^2.2.0",
|
||||||
@ -20,6 +21,7 @@
|
|||||||
"react-scripts": "^5.0.0",
|
"react-scripts": "^5.0.0",
|
||||||
"react-tracked": "^1.7.6",
|
"react-tracked": "^1.7.6",
|
||||||
"scheduler": "^0.20.2",
|
"scheduler": "^0.20.2",
|
||||||
|
"unpacker": "^1.0.1",
|
||||||
"web-vitals": "^1.0.1"
|
"web-vitals": "^1.0.1"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
96
src/providers/list/gdriveplayer/index.ts
Normal file
96
src/providers/list/gdriveplayer/index.ts
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
import {
|
||||||
|
MWMediaProvider,
|
||||||
|
MWMediaType,
|
||||||
|
MWPortableMedia,
|
||||||
|
MWMediaStream,
|
||||||
|
MWQuery,
|
||||||
|
MWMediaSeasons,
|
||||||
|
MWProviderMediaResult
|
||||||
|
} from "providers/types";
|
||||||
|
|
||||||
|
import { CORS_PROXY_URL } from "mw_constants";
|
||||||
|
import { unpack } from "unpacker";
|
||||||
|
import CryptoJS from "crypto-js";
|
||||||
|
|
||||||
|
const format = {
|
||||||
|
stringify: (cipher: any) => {
|
||||||
|
const ct = cipher.ciphertext.toString(CryptoJS.enc.Base64);
|
||||||
|
const iv = cipher.iv.toString() || "";
|
||||||
|
const salt = cipher.salt.toString() || "";
|
||||||
|
return JSON.stringify({
|
||||||
|
ct,
|
||||||
|
iv,
|
||||||
|
salt,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
parse: (jsonStr: string) => {
|
||||||
|
const json = JSON.parse(jsonStr);
|
||||||
|
const ciphertext = CryptoJS.enc.Base64.parse(json.ct);
|
||||||
|
const iv = CryptoJS.enc.Hex.parse(json.iv) || "";
|
||||||
|
const salt = CryptoJS.enc.Hex.parse(json.s) || "";
|
||||||
|
|
||||||
|
const cipher = CryptoJS.lib.CipherParams.create({
|
||||||
|
ciphertext,
|
||||||
|
iv,
|
||||||
|
salt,
|
||||||
|
});
|
||||||
|
return cipher;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const gDrivePlayerScraper: MWMediaProvider = {
|
||||||
|
id: "gdriveplayer",
|
||||||
|
enabled: true,
|
||||||
|
type: [MWMediaType.MOVIE],
|
||||||
|
displayName: "gdriveplayer",
|
||||||
|
|
||||||
|
async getMediaFromPortable(media: MWPortableMedia): Promise<MWProviderMediaResult> {
|
||||||
|
const res = await fetch(`${CORS_PROXY_URL}https://api.gdriveplayer.us/v1/imdb/${media.mediaId}`).then((d) => d.json());
|
||||||
|
|
||||||
|
return {
|
||||||
|
...media,
|
||||||
|
title: res.Title,
|
||||||
|
year: res.Year,
|
||||||
|
} as MWProviderMediaResult;
|
||||||
|
},
|
||||||
|
|
||||||
|
async searchForMedia(query: MWQuery): Promise<MWProviderMediaResult[]> {
|
||||||
|
const searchRes = await fetch(`${CORS_PROXY_URL}https://api.gdriveplayer.us/v1/movie/search?title=${query.searchQuery}`).then((d) => d.json());
|
||||||
|
|
||||||
|
const results: MWProviderMediaResult[] = [];
|
||||||
|
for (const item of searchRes) {
|
||||||
|
results.push({
|
||||||
|
title: item.title,
|
||||||
|
year: item.year,
|
||||||
|
mediaId: item.imdb,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return results;
|
||||||
|
},
|
||||||
|
|
||||||
|
async getStream(media: MWPortableMedia): Promise<MWMediaStream> {
|
||||||
|
const streamRes = await fetch(`${CORS_PROXY_URL}https://database.gdriveplayer.us/player.php?imdb=${media.mediaId}`).then((d) => d.text());
|
||||||
|
const page = new DOMParser().parseFromString(streamRes, "text/html");
|
||||||
|
|
||||||
|
const script: HTMLElement | undefined = Array.from(
|
||||||
|
page.querySelectorAll("script")
|
||||||
|
).find((e) => e.textContent?.includes("eval"));
|
||||||
|
|
||||||
|
if (!script || !script.textContent) {
|
||||||
|
throw new Error("Could not find stream");
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = unpack(script.textContent).split("var data=\\'")[1].split("\\'")[0].replace(/\\/g, "");
|
||||||
|
const decryptedData = unpack(CryptoJS.AES.decrypt(data, "alsfheafsjklNIWORNiolNIOWNKLNXakjsfwnBdwjbwfkjbJjkopfjweopjASoiwnrflakefneiofrt", { format }).toString(CryptoJS.enc.Utf8));
|
||||||
|
// eslint-disable-next-line
|
||||||
|
const sources = JSON.parse(JSON.stringify(eval(decryptedData.split("sources:")[1].split(",image")[0].replace(/\\/g, "").replace(/document\.referrer/g, "\"\""))));
|
||||||
|
const source = sources[sources.length - 1];
|
||||||
|
|
||||||
|
return { url: `https:${source.file}`, type: source.type, captions: [] };
|
||||||
|
},
|
||||||
|
|
||||||
|
async getSeasonDataFromMedia(media: MWPortableMedia): Promise<MWMediaSeasons> {
|
||||||
|
return {} as MWMediaSeasons;
|
||||||
|
}
|
||||||
|
};
|
@ -1,8 +1,10 @@
|
|||||||
import { theFlixScraper } from "providers/list/theflix";
|
import { theFlixScraper } from "providers/list/theflix";
|
||||||
|
import { gDrivePlayerScraper } from "providers/list/gdriveplayer";
|
||||||
import { MWWrappedMediaProvider, WrapProvider } from "providers/wrapper";
|
import { MWWrappedMediaProvider, WrapProvider } from "providers/wrapper";
|
||||||
|
|
||||||
export const mediaProvidersUnchecked: MWWrappedMediaProvider[] = [
|
export const mediaProvidersUnchecked: MWWrappedMediaProvider[] = [
|
||||||
WrapProvider(theFlixScraper),
|
WrapProvider(theFlixScraper),
|
||||||
|
WrapProvider(gDrivePlayerScraper),
|
||||||
];
|
];
|
||||||
|
|
||||||
export const mediaProviders: MWWrappedMediaProvider[] =
|
export const mediaProviders: MWWrappedMediaProvider[] =
|
||||||
|
Loading…
Reference in New Issue
Block a user