DevUploads | Auto download

Get download link from devuploads

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name           DevUploads | Auto download
// @name:vi        DevUploads | Tự động tải
// @namespace      DevUploads
// @version        25.02.13.c
// @description    Get download link from devuploads
// @description:vi Tự động lấy link tải file từ DevUploads
// @author         https://t.me/DariasLuc
// @icon           https://www.google.com/s2/favicons?sz=128&domain=devuploads.com
// @homepage       https://xem.li/DevUl
// @match          https://djxmaza.in/*
// @match          https://gujjukhabar.in/*
// @match          https://devuploads.com/*
// @grant          none
// ==/UserScript==

(function() {
    'use strict';

    function createLogPanel() {
        const logPanel = document.createElement('div');
        logPanel.id = 'logPanel';
        logPanel.style.position = 'fixed';
        logPanel.style.bottom = '10px';
        logPanel.style.left = '10px';
        logPanel.style.padding = '10px';
        logPanel.style.backgroundColor = 'rgba(0, 0, 0, 0.8)';
        logPanel.style.color = 'white';
        logPanel.style.fontSize = '12px';
        logPanel.style.zIndex = '999999';
        logPanel.style.maxWidth = '300px';
        logPanel.style.overflow = 'hidden';
        logPanel.style.borderRadius = '5px';
        logPanel.innerHTML = '<b>Auto Download Log</b><br>';
        document.body.appendChild(logPanel);
    }

    function logMessage(message) {
        const logPanel = document.getElementById('logPanel');
        if (logPanel) {
            logPanel.innerHTML += message + '<br>';
            logPanel.scrollTop = logPanel.scrollHeight;
        }
    }

    function waitForElement(selector, callback) {
        const observer = new MutationObserver((mutations, obs) => {
            const element = document.querySelector(selector);
            if (element) {
                obs.disconnect();
                callback(element);
            }
        });
        observer.observe(document.body, { childList: true, subtree: true });
    }

    function protectElements() {
        const style = document.createElement('style');
        style.textContent = `
            #dlndiv {
                display: block !important;
                visibility: visible !important;
                opacity: 1 !important;
                position: relative !important;
                z-index: 999999 !important;
            }
            #dlndiv img {
                display: block !important;
                visibility: visible !important;
                opacity: 1 !important;
            }
        `;
        document.head.appendChild(style);
    }

    function findDownloadLink() {
        const scripts = document.scripts;
        for (let script of scripts) {
            if (script.textContent.includes(".devuploads.com/d")) {
                const match = script.textContent.match(/https?:\/\/[^\s"']+\.devuploads\.com\/d\/[^\s"']+/);
                if (match) {
                    const downloadLink = match[0];
                    logMessage("Tìm thấy link tải: " + downloadLink);

                    const downloadImage = document.querySelector("#dlndiv img");
                    if (downloadImage) {
                        downloadImage.onclick = () => window.open(downloadLink, '_self');
                    }

                    window.location.href = downloadLink;
                    return;
                }
            }
        }
    }

    function runScript() {
        waitForElement('#gdl', (gdlButton) => {
            gdlButton.click();
            logMessage("Đã click nút 'Generate Download Link'");

            waitForElement('#gdlf', (gdlfButton) => {
                gdlfButton.click();
                logMessage("Đã click nút 'Go to Generated Link'");
            });
        });
    }

    function autoRun() {
        document.addEventListener("visibilitychange", () => {
            if (!document.hidden) {
                logMessage("Tab active, chạy lại script...");
                findDownloadLink();
                runScript();
            }
        });
    }

    createLogPanel();
    protectElements();
    findDownloadLink();
    runScript();
    autoRun();
})();