Fuolah

Fucking wuolah with sstyle

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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
    });
})();