F95Zone.to - Pixeldrain/Gofile No Limit DL

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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});
})();