1Fichier Redirect to FastDebrid

Save 1fichier link, redirect to FastDebrid and autofill the link.

目前为 2025-03-03 提交的版本。查看 最新版本

// ==UserScript==
// @name         1Fichier Redirect to FastDebrid
// @namespace    https://violentmonkey.github.io/
// @version      1.1
// @description  Save 1fichier link, redirect to FastDebrid and autofill the link.
// @author       Rust1667
// @match        https://1fichier.com/*
// @match        https://fastdebrid.com/*
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// ==/UserScript==

(function() {
    'use strict';

    // Function to check if the Cloudflare captcha is solved
    function checkCloudflareCaptchaSolved() {
        if (document.querySelector('.cf-turnstile') || document.querySelector('#captcha-turnstile')) {
            return unsafeWindow.turnstile && unsafeWindow.turnstile.getResponse().length !== 0;
        }
        return true;
    }

    // On 1fichier page
    const currentUrl = window.location.href;
    if (currentUrl.includes('1fichier.com')) {
        GM_setValue('saved1FichierLink', currentUrl);
        window.location.assign('https://fastdebrid.com/');

    // On FastDebrid page
    } else if (currentUrl === 'https://fastdebrid.com/') {

        window.addEventListener('load', function() {

            const fichierOption = document.querySelector('[data-name="1fichier"]');
            if (fichierOption) {
                fichierOption.click();
            }

            function fillForm() {
                const savedLink = GM_getValue('saved1FichierLink');
                if (savedLink) {
                    const inputField = document.querySelector('#link');
                    if (inputField) {
                        inputField.value = savedLink;
                        GM_deleteValue('saved1FichierLink');
                    }
                }
            }

            function clickDebridButton() {
                const debridButton = document.querySelector('button.btn-primary');
                if (debridButton && debridButton.innerText.includes('Debrid my link')) {
                    debridButton.click();
                }
            }

            // Wait for cloudflare captcha to be solved to fill the form
            let captchaCheckInterval = setInterval(() => {
                if (checkCloudflareCaptchaSolved()) {
                    clearInterval(captchaCheckInterval);
                    fillForm();
                    clickDebridButton();
                }
            }, 1000);
        

      });


    // On fastdebrid page with link ready for download
    } else if (/https:\/\/fastdebrid.com\/.*/.test(currentUrl)) {
        window.location.assign(document.querySelector('a.btn-primary.mx-1').href);
        window.location.assign(document.querySelector('a.btn-success.mx-1').href);
    }

})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址