From 277719eb50150ddb77be609b5e014a51aef6657e Mon Sep 17 00:00:00 2001 From: Ritesh Ghosh Date: Thu, 19 Dec 2024 17:10:30 +0530 Subject: [PATCH] fix(megacloud): `WebAssembly.instantiate(): Argument 0 must be a buffer source` error --- src/extractors/megacloud.getsrcs.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/extractors/megacloud.getsrcs.ts b/src/extractors/megacloud.getsrcs.ts index 4dff771..d362402 100644 --- a/src/extractors/megacloud.getsrcs.ts +++ b/src/extractors/megacloud.getsrcs.ts @@ -259,10 +259,14 @@ function Qj(QP: ArrayLike, Qn: any) { ); } +function isResponse(obj: Object) { + return Object.prototype.toString.call(obj) === "[object Response]"; +} + async function QN(QP: Response, Qn: WebAssembly.Imports) { let QT: ArrayBuffer, Qt: any; - return "function" == typeof Response && QP instanceof Response + return "function" == typeof Response && isResponse(QP) ? ((QT = await QP.arrayBuffer()), (Qt = await WebAssembly.instantiate(QT, Qn)), Object.assign(Qt, { bytes: QT }))