Fuolah

Fucking wuolah with sstyle

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Fuolah
// @namespace    http://tuculito.com
// @version      1.2.1
// @description  Fucking wuolah with sstyle
// @author       Alejandro12120 & Taxalo
// @match        https://wuolah.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=wuolah.com
// @grant        none
// @require      https://code.jquery.com/jquery-3.7.1.min.js
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/js.cookie.min.js
// ==/UserScript==

(function () {
    "use strict";

    $(document).ready(() => {
        const alreadyDownloadedDocs = [];
        const downloadUrl = "https://api.wuolah.com/v2/download";

        const tokenCookie = Cookies.get("token");
        const machineCookie = Cookies.get("segMachineId");
        const referralCookie = Cookies.get("invitationCode");

        console.log("Loaded downloader with token: ", tokenCookie);

        setInterval(() => {
            const parent = document.querySelector("div.css-tm6h1a");

            if (!parent) return sendFileStatus(false); // If no parent found return

            let identificator;

            for (let i = 0; i < parent.childNodes.length; i++) {
                const file = parent.childNodes[i];

                if (!file.href) continue;
                if (!file.href.match(/(https:\/\/wuolah\.com\/apuntes\/)(?<=\/)(.*?)(?=\/).*/gm)) continue;

                try {
                    identificator = file.href.split("-").at(-1);
                    console.log(identificator)

                    if (identificator) break;
                } catch (error) {
                    continue;
                }
            }

            if (alreadyDownloadedDocs.includes(identificator)) return;
            const xhr = new XMLHttpRequest();
            xhr.open("POST", downloadUrl, true);
            xhr.setRequestHeader("Content-Type", "application/json");
            xhr.setRequestHeader("Authorization", `Bearer ${tokenCookie}`);

            const jsonData = JSON.stringify({
                "adblockDetected": false,
                "ads": [],
                "fileId": parseInt(identificator),
                "machineId": machineCookie,
                "noAdsWithCoins": false,
                "referralCode": (referralCookie ? referralCookie : ""),
                "ubication17ExpectedPubs": 1,
                "ubication17RequestedPubs": 1,
                "ubication1ExpectedPubs": 1,
                "ubication1RequestedPubs": 1,
                "ubication2ExpectedPubs": 5,
                "ubication2RequestedPubs": 5,
                "ubication3ExpectedPubs": 15,
                "ubication3RequestedPubs": 15
            });

            xhr.onload = function () {
                const response = JSON.parse(this.response);
                if (!response.url) return;

                window.open(response.url);

                /* 
                Big L to Wuolah.
                
                Thanks to Taxalo for reversing the algorithm.
                (https://github.com/taxalo)
                */
            };

            xhr.send(jsonData);
            alreadyDownloadedDocs.push(identificator);
        }, 2000); // 2 seconds
    });
})();