yoinked from yuzono

This commit is contained in:
AlmightyHak 2025-06-19 12:39:19 -05:00
parent 9a5e2a9083
commit cc12318692

View file

@ -2,7 +2,7 @@
// solution inspired from https://github.com/drblgn/rabbit_wasm/blob/main/rabbit.ts
// solution inspired from https://github.com/shimizudev/consumet.ts/blob/master/dist/extractors/megacloud/megacloud.getsrcs.js
const embed_url = 'https://megacloud.tv/embed-2/e-1/';
const embed_url = 'https://megacloud.tv/embed-2/v2/e-1/';
const referrer = 'https://hianime.to';
const user_agent = navigator.userAgent;
let wasm;
@ -31,7 +31,7 @@ const image_data = {
data: window.decoded_png,
};
const canvas = {
baseUrl: 'https://megacloud.tv/embed-2/e-1/1hnXq7VzX0Ex?k=1',
baseUrl: 'https://megacloud.tv/embed-2/v2/e-1/1hnXq7VzX0Ex?k=1',
width: 0,
height: 0,
style: {
@ -58,7 +58,7 @@ const fake_window = {
},
origin: 'https://megacloud.tv',
location: {
href: 'https://megacloud.tv/embed-2/e-1/1hnXq7VzX0Ex?k=1',
href: 'https://megacloud.tv/embed-2/v2/e-1/1hnXq7VzX0Ex?k=1',
origin: 'https://megacloud.tv',
},
performance: {
@ -676,7 +676,7 @@ async function getSources(xrax) {
let res = {};
try {
await V();
let getSourcesUrl = 'https://megacloud.tv/embed-2/ajax/e-1/getSources?id=' +
let getSourcesUrl = 'https://megacloud.tv/embed-2/v2/e-1/getSources?id=' +
fake_window.pid +
'&v=' +
fake_window.localStorage.kversion +
@ -688,7 +688,7 @@ async function getSources(xrax) {
headers: {
'User-Agent': user_agent,
//"Referrer": fake_window.origin + "/v2/embed-4/" + xrax + "?z=",
Referer: embed_url + xrax + '?k=1',
Referer: embed_url + xrax + '?k=1&autoPlay=1&oa=0&asi=1',
'X-Requested-With': 'XMLHttpRequest',
},
method: 'GET',