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