AnonyViet Link Bypass

Bypass AnonyViet link redirection

目前為 2024-11-15 提交的版本,檢視 最新版本

// ==UserScript==
// @name         AnonyViet Link Bypass
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Bypass AnonyViet link redirection
// @author       Yuusei
// @match        https://anonyviet.com/tieptucdentrangmoi/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=anonyviet.com
// @license   MIT
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function extractGoogleDriveLink(url) {
        // Handle both "view" and "edit" URLs
        const match = url.match(/\/d\/([^\/]+)\/(view|edit)/);
        if (match) {
            return `https://drive.google.com/uc?id=${match[1]}&export=download`;
        }
        return url; // Return original URL if no match
    }

    let encodedUrl = document.getElementById('target-link')?.dataset.targetLink;

    if (encodedUrl) {
        let decodedUrl = atob(encodedUrl);
        window.location.href = extractGoogleDriveLink(decodedUrl);
    } else {
        let directLink = document.querySelector('.linkdown a');
        if (directLink) {
             window.location.href = extractGoogleDriveLink(directLink.href);

        }
    }
})();