diff --git a/src/lib/match.ts b/src/lib/match.ts index f318403..2969384 100644 --- a/src/lib/match.ts +++ b/src/lib/match.ts @@ -113,22 +113,30 @@ export const Luluvdo: Match = { regex: [/./gm], match: async () => { - const post_match = window.location.href.match(/(?<=\/embed\/)\S*(\/.*)?/)!; + const postMatch = window.location.href.match(/(?<=\/embed\/)\S*(\/.*)?/)!; - const request_body = new FormData(); - request_body.set('op', 'embed'); - request_body.set('file_code', post_match[0]); + const requestBody = new FormData(); + requestBody.set('op', 'embed'); + requestBody.set('file_code', postMatch[0]); const response = await fetch(`https://${window.location.host}/dl`, { method: 'POST', - body: request_body, + body: requestBody, referrer: window.location.href }); - const eval_match = (await response.text()).match( - /eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms - )!; + let unpacked; + + const responseText = await response.text(); + const evalMatch = responseText.match(/eval\(function\(p,a,c,k,e,d\).*?(?=<\/script>)/gms)!; + // sometimes is packed, sometimes it's not. looks like someone forgets to obfuscate the code when pushing to + // production + if (evalMatch) { + unpacked = await unpack(evalMatch[0]); + return unpacked.match(/(?<=file:").*(?=")/)![0]; + } else { + unpacked = responseText; + } - const unpacked = await unpack(eval_match[0]); return unpacked.match(/(?<=file:").*(?=")/)![0]; } };