F95Zone.to - Pixeldrain/Gofile No Limit DL

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

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