Last active
January 30, 2025 01:20
-
-
Save S8D/bdbdc139fe5f0ae8a7f7c6306accb7a0 to your computer and use it in GitHub Desktop.
DevUploads
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Get download link for DevUploads | |
| // @name:vi Lấy link tải DevUploads | |
| // @namespace DevUploads | |
| // @version 25.01.30.a | |
| // @description Get download link from devuploads | |
| // @description:vi Lấy link tải DevUploads | |
| // @author Darias | |
| // @homepage https://xem.li/DevUploads | |
| // @downloadURL https://xem.li/DevUploads | |
| // @updateURL https://xem.li/DevUploads | |
| // @match *://jytechs.in/* | |
| // @match *://devuploads.com/* | |
| // @match *://thecubexguide.com/* | |
| // @match *://smartfeecalculator.com/* | |
| // @run-at document-start | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| // Kiểm tra URL có chứa devuploads ID không | |
| function hasDevUploadsId(url) { | |
| return /devuploads\.com\/[a-zA-Z0-9]{12}/.test(url); | |
| } | |
| // Xử lý chuyển hướng trực tiếp nếu là URL devuploads | |
| if(hasDevUploadsId(document.referrer)) { | |
| // Lưu URL gốc để xử lý sau | |
| sessionStorage.setItem('originalDevUploadsUrl', document.referrer); | |
| } | |
| // Đợi DOM load xong | |
| function waitForElement(selector) { | |
| return new Promise(resolve => { | |
| if (document.querySelector(selector)) { | |
| return resolve(document.querySelector(selector)); | |
| } | |
| const observer = new MutationObserver(mutations => { | |
| if (document.querySelector(selector)) { | |
| observer.disconnect(); | |
| resolve(document.querySelector(selector)); | |
| } | |
| }); | |
| observer.observe(document.body, { | |
| childList: true, | |
| subtree: true | |
| }); | |
| }); | |
| } | |
| // Hàm chính để xử lý | |
| async function processDownloadLink() { | |
| // Tìm URL trong script | |
| let scripts = document.getElementsByTagName('script'); | |
| let downloadUrl = ''; | |
| for(let script of scripts) { | |
| if(script.innerHTML.includes('slowdlbtn')) { | |
| // Dùng regex để lấy URL | |
| let match = script.innerHTML.match(/window\.open\('(.*?)',/); | |
| if(match && match[1]) { | |
| downloadUrl = match[1]; | |
| break; | |
| } | |
| } | |
| } | |
| if(downloadUrl) { | |
| // Đợi nút Try Again xuất hiện | |
| let tryAgainBtns = ['#tryAgain1', '#tryAgain2']; | |
| for(let btnSelector of tryAgainBtns) { | |
| let btn = await waitForElement(btnSelector); | |
| if(btn) { | |
| // Thay đổi nút Try Again | |
| btn.textContent = 'Download'; | |
| btn.className = 'btn btn-success btn-block mb-4'; | |
| btn.removeAttribute('id'); | |
| // Gắn sự kiện click mới | |
| btn.onclick = function(e) { | |
| e.preventDefault(); | |
| window.open(downloadUrl, '_blank'); | |
| }; | |
| } | |
| } | |
| // Thêm nút download phụ nếu cần | |
| let container = document.querySelector('.download-page'); | |
| if(container) { | |
| let extraBtn = document.createElement('a'); | |
| extraBtn.textContent = 'Download'; | |
| extraBtn.className = 'btn btn-primary btn-block mb-4'; | |
| extraBtn.href = downloadUrl; | |
| extraBtn.target = '_blank'; | |
| container.appendChild(extraBtn); | |
| } | |
| } | |
| } | |
| // Xử lý khi DOM loaded | |
| if(document.readyState === 'loading') { | |
| document.addEventListener('DOMContentLoaded', processDownloadLink); | |
| } else { | |
| processDownloadLink(); | |
| } | |
| // Thêm observer để xử lý các thay đổi động | |
| const observer = new MutationObserver((mutations) => { | |
| mutations.forEach((mutation) => { | |
| if(mutation.addedNodes.length) { | |
| processDownloadLink(); | |
| } | |
| }); | |
| }); | |
| observer.observe(document.documentElement, { | |
| childList: true, | |
| subtree: true | |
| }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment