Greasy Fork is available in English.

DevUploads | Auto download

Get download link from devuploads

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

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