F95Zone.to - Pixeldrain/Gofile No Limit DL

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

// ==UserScript==
// @name         F95Zone.to - Pixeldrain/Gofile No Limit DL
// @namespace    https://greasyfork.org/fr/users/1468290-payamarre
// @version      1.3
// @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==

/*
 * >> 🔓 -> Click to generate the bypass link.
 * >> ❌ -> Link couldn't be generated due to a CAPTCHA. Open the Pixeldrain link, complete the CAPTCHA, close the window, then click ❌ again.
 * >> [DIRECT LINK] -> The direct link has been generated. Left-click to download instantly, or right-click to copy the link.
 */



(function () {
    'use strict';

    const style = document.createElement('style');
    style.textContent = `
        .cybar-unlock-btn {
            margin-left: 5px;
            cursor: pointer;
            background: #444;
            color: #ec5555;
            border: none;
            border-radius: 5px;
            margin: 5px;
            font-family: Verdana, sans-serif !important;
            align-items: center;
            gap: 0.2em;
            height: 30px;
        }
        .cybar-unlock-btn-text {
            text-decoration: none;
        }
        .cybar-unlock-btn:hover .cybar-unlock-btn-text {
            color: #f5a3a3;
            text-decoration: underline;
        }
        .cybar-direct-link {
            display: inline-block;
            align-items: center;
            color: #a4be8c;
            margin-left: 5px;
            margin: 5px;
            height: 30px;
            line-height: 25px;
            font-family: Verdana, sans-serif;
            text-decoration: none;
            cursor: pointer;
            user-select: none;
            font-size: 18px;
        }
        .cybar-direct-link:hover {
            text-decoration: underline;
            color: #c7e7a4;
        }
    `;
    document.head.appendChild(style);

    const CYBAR_PX = "https://pd.cybar.xyz/";
    const CYBAR_GF = "https://gf.cybar.xyz/";

    function handlePixeldrainLinks() {
        const links = document.querySelectorAll('a[href*="/masked/pixeldrain.com/"]');

        links.forEach(link => {
            if (link.dataset.cybarManual) return;
            link.dataset.cybarManual = "true";

            const fetchButton = document.createElement('button');
            fetchButton.className = "cybar-unlock-btn";

            const emojiSpan = document.createElement('span');
            emojiSpan.textContent = "🔓";

            const textSpan = document.createElement('span');
            textSpan.className = "cybar-unlock-btn-text";
            textSpan.textContent = "UNLOCK LINK";

            fetchButton.appendChild(emojiSpan);
            fetchButton.appendChild(textSpan);

            fetchButton.addEventListener('click', () => {
                emojiSpan.textContent = "";
                textSpan.textContent = "⏳...";

                GM_xmlhttpRequest({
                    method: "POST",
                    url: link.href,
                    headers: {
                        "Content-Type": "application/x-www-form-urlencoded"
                    },
                    data: "xhr=1&download=1",
                    onload: function (res) {
                        try {
                            const json = JSON.parse(res.responseText);
                            const pxMatch = json.msg.match(/pixeldrain\.com\/u\/([\w\d]+)/);

                            if (pxMatch && pxMatch[1]) {
                                const cybarLink = document.createElement('a');
                                cybarLink.href = CYBAR_PX + pxMatch[1];
                                cybarLink.className = "cybar-direct-link";
                                cybarLink.textContent = `[DIRECT LINK]`;
                                cybarLink.target = "_blank";
                                fetchButton.replaceWith(cybarLink);
                            } else {
                                emojiSpan.textContent = "";
                                textSpan.textContent = "❌ CAPTCHA?";
                            }
                        } catch {
                            emojiSpan.textContent = "";
                            textSpan.textContent = "⚠️ ERROR";
                        }
                    },
                    onerror: () => {
                        emojiSpan.textContent = "";
                        textSpan.textContent = "❌ HTTP ERROR";
                    }
                });
            });

            link.insertAdjacentElement('afterend', fetchButton);
        });
    }

    function checkGofileLink(url, callback) {
        GM_xmlhttpRequest({
            method: 'HEAD',
            url: url,
            onload: function (res) {
                if (res.status >= 200 && res.status < 400) {
                    callback(true);
                } else {
                    callback(false);
                }
            },
            onerror: function () {
                callback(false);
            }
        });
    }

    function handleGofileLinks() {
        const links = document.querySelectorAll('a[href*="gofile.io/d/"]');

        links.forEach(link => {
            if (link.dataset.cybarGofile) return;
            link.dataset.cybarGofile = "true";

            const match = link.href.match(/gofile\.io\/d\/([\w\d]+)/);
            if (!match || !match[1]) return;

            const fileId = match[1];
            const bypassLink = CYBAR_GF + fileId;

            const emojiLink = document.createElement('a');
            emojiLink.href = bypassLink;
            emojiLink.target = "_blank";
            emojiLink.className = "cybar-direct-link";
            emojiLink.textContent = "⬇️";

            checkGofileLink(bypassLink, function (isAlive) {
                if (!isAlive) {
                    emojiLink.textContent = "💀";
                    emojiLink.href = "javascript:void(0)";
                    emojiLink.addEventListener('click', () => {
                        event.preventDefault();
                        alert("DEAD LINK 💀");
                    });
                }
            });

            link.insertAdjacentElement('afterend', emojiLink);
        });
    }

    function runAll() {
        handlePixeldrainLinks();
        handleGofileLinks();
    }

    runAll();
    const observer = new MutationObserver(runAll);
    observer.observe(document.body, { childList: true, subtree: true });
})();