F95Zone.to - Pixeldrain/Gofile No Limit DL

Want unlimited Download on Pixeldrain? This script integrates a raw pd.cybar.xyz URL into F95Zone threads

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         F95Zone.to - Pixeldrain/Gofile No Limit DL
// @namespace    https://greasyfork.org/fr/users/1468290-payamarre
// @version      1.5
// @icon         https://www.google.com/s2/favicons?sz=64&domain=f95zone.to
// @description  Want unlimited Download on Pixeldrain? This script integrates a raw pd.cybar.xyz URL into F95Zone threads
// @author       NoOne
// @license MIT
// @match        https://f95zone.to/*
// @grant        GM_xmlhttpRequest
// @connect      f95zone.to
// ==/UserScript==

(function(){
    const CYGF="https://gf.1drv.eu.org/";
    const CYPX="https://pd.1drv.eu.org/";

    const style=document.createElement("style");
    style.textContent=".dlx{cursor:pointer;background:none;border:none;font-size:18px;margin-left:6px;text-decoration:none;color:inherit}";
    document.head.appendChild(style);

    function attachButton(a){
        if(a.nextSibling && a.nextSibling.classList && a.nextSibling.classList.contains("dlx")) return;

        const b=document.createElement("button");
        b.className="dlx";
        b.textContent="🔃";

        b.onclick=()=>processLink(a,b);

        a.insertAdjacentElement("afterend",b);
    }

    function processLink(a,b){
        b.textContent="⏳";
        GM_xmlhttpRequest({
            method:"POST",
            url:a.href,
            headers:{"Content-Type":"application/x-www-form-urlencoded"},
            data:"xhr=1&download=1",
            onload:r=>{
                let json;
                try{ json=JSON.parse(r.responseText); }
                catch(e){ b.textContent="❌"; openCaptcha(a.href); return; }
                if(!json.msg){ b.textContent="❌"; openCaptcha(a.href); return; }

                let html=json.msg;
                let g=html.match(/gofile\.io\/d\/([\w\d]+)/);
                let p=html.match(/pixeldrain\.com\/u\/([\w\d]+)/);

                let linkUrl=null;
                if(g) linkUrl=CYGF+g[1];
                else if(p) linkUrl=CYPX+p[1];

                if(linkUrl){
                    const aLink=document.createElement("a");
                    aLink.href=linkUrl;
                    aLink.textContent="⬇️";
                    aLink.target="_blank";
                    aLink.className="dlx";
                    b.replaceWith(aLink);
                    return;
                }

                if(/captcha|recaptcha/i.test(html)){ b.textContent="❌"; openCaptcha(a.href); return; }
                b.textContent="💀";
            },
            onerror:()=>b.textContent="💀"
        });
    }

    function openCaptcha(url){
        window.open(url,"captcha","width=600,height=800");
    }

    function scanLinks(){
        document.querySelectorAll('a[href*="/masked/gofile.io/"],a[href*="/masked/pixeldrain.com/"]').forEach(attachButton);
    }

    scanLinks();
    new MutationObserver(scanLinks).observe(document.body,{childList:true,subtree:true});
})();