Parser_PayLoad_JVC

Parser_PayLoad_JVC_Html_Or_Str

Dit script moet niet direct worden geïnstalleerd - het is een bibliotheek voor andere scripts om op te nemen met de meta-richtlijn // @require https://update.greasyfork.org/scripts/588212/1908643/Parser_PayLoad_JVC.js

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// Parser_JVC_PayLoad.js
// ASYNCH

async function getPayloadFromHtml(doc) {
    //Test base64(gzip(JSON))
    try {
        const payload64 = [...doc.scripts].map(s => s.textContent.match(/jvc\.\w+Payload\s*=\s*["']([^"']+)["']/)).find(Boolean)?.[1];
        if (payload64) {
            const bytes = Uint8Array.from(atob(payload64), c => c.charCodeAt(0));
            const decompressedStream = new Blob([bytes]).stream().pipeThrough(new DecompressionStream('gzip'));
            return await new Response(decompressedStream).json();
        }
    } catch {}
    //Test base64(JSON)
    try {
        const payload64 = [...doc.scripts].map(s => s.textContent.match(/jvc\.\w+Payload\s*=\s*["']([^"']+)["']/)).find(Boolean)?.[1];
        if (payload64) return JSON.parse(atob(payload64));
    } catch {}
    //Test natif
    try {
        const payload = [...doc.scripts].map(s => s.textContent.match(/jvc\.\w*payload\s*=\s*(\{[\s\S]*?\})\s*;/i)).find(Boolean)?.[1];
        if (payload) return JSON.parse(payload);
    } catch {}
    return null;
}


async function getPayloadFromRaw(rawData) {
    //Test  base64(gzip(JSON))
    try {
        const payload64 = rawData.match(/jvc\.\w+Payload\s*=\s*["']([^"']+)["']/)?.[1];
        if (payload64) {
            const bytes = Uint8Array.from(atob(payload64), c => c.charCodeAt(0));
            const decompressedStream = new Blob([bytes]).stream().pipeThrough(new DecompressionStream('gzip'));
            return await new Response(decompressedStream).json();
        }
    } catch {}
    //Test base64(JSON)
    try {
        const payload64 = rawData.match(/jvc\.\w+Payload\s*=\s*["']([^"']+)["']/)?.[1];
        if (payload64) return JSON.parse(atob(payload64));
    } catch {}
    //Test natif
    try {
        const scripts = rawData.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi) || [];
        const payload = scripts.map(s => s.match(/jvc\.\w*payload\s*=\s*(\{[\s\S]*?\})\s*;/i)).find(Boolean)?.[1];
        if (payload) return JSON.parse(payload);
    } catch {}
    return null;
}