megacloud-fix #1021

Merged
AlmightyHak merged 2 commits from megacloud-fix into main 2025-06-19 13:34:01 -05:00
Showing only changes of commit cc12318692 - Show all commits

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: {
@ -327,9 +327,9 @@ function initWasm() {
__wbg_createElement_03cf347ddad1c8c0: function () {
return applyToWindow(function (
// @ts-ignore
index,
index,
// @ts-ignore
decodeIndex,
decodeIndex,
// @ts-ignore
decodeIndexOffset) {
return addToStack(canvas);
@ -338,9 +338,9 @@ function initWasm() {
__wbg_querySelector_118a0639aa1f51cd: function () {
return applyToWindow(function (
// @ts-ignore
index,
index,
// @ts-ignore
decodeIndex,
decodeIndex,
// @ts-ignore
decodeOffset) {
//let item = get(index).querySelector(decodeSub(decodeIndex, decodeOffset));
@ -353,11 +353,11 @@ function initWasm() {
return addToStack(nodeList);
}, arguments);
},
__wbg_getAttribute_706ae88bd37410fa: function (offset,
__wbg_getAttribute_706ae88bd37410fa: function (offset,
// @ts-ignore
index,
index,
// @ts-ignore
decodeIndex,
decodeIndex,
// @ts-ignore
decodeOffset) {
//let attr = get(index).getAttribute(decodeSub(decodeIndex, decodeOffset));
@ -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',
@ -711,4 +711,4 @@ async function getSources(xrax) {
catch (err) {
console.error(err);
}
}
}