PearCrypt Skip

Extract all direct links on PearCrypt without the site loading all its bloated garbage.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         PearCrypt Skip
// @version      05-18-26
// @description  Extract all direct links on PearCrypt without the site loading all its bloated garbage.
// @author       maybeyou
// @match        https://pearcrypt.lol/container/*
// @grant        none
// @run-at       document-start
// @namespace https://greatest.deepsurf.us/users/1122886
// ==/UserScript==

(function() {
    'use strict';

    var s = document.createElement('style');
    s.textContent = 'body{display:none!important}';
    document.documentElement.appendChild(s);

    function ready(fn) {
        if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', fn);
        else fn();
    }

    function waitEl(sel, ms) {
        return new Promise(function(res, rej) {
            var t = Date.now();
            function check() {
                var el = document.querySelector(sel);
                if (el) return res(el);
                if (Date.now() - t > (ms||20000)) return rej();
                requestAnimationFrame(check);
            }
            check();
        });
    }

    function waitDialog(ms) {
        return new Promise(function(res, rej) {
            var obs = new MutationObserver(function() {
                var d = document.querySelector('[role="dialog"]');
                if (d && d.dataset.state === 'open') { obs.disconnect(); res(d); }
            });
            obs.observe(document.body, {childList:true, subtree:true, attributes:true, attributeFilter:['data-state']});
            setTimeout(function(){ obs.disconnect(); rej(); }, ms||8000);
        });
    }

    async function getLinks() {
        var btn = await waitEl('button:has(svg.lucide-link2)');
        btn.click();
        var dlg = await waitDialog();
        var els = dlg.querySelectorAll('div[data-radix-scroll-area-viewport] div.rounded-md');
        return Array.from(els).map(function(e){ return e.textContent.trim(); });
    }

    function show(links) {
        window.stop();
        document.documentElement.innerHTML = '';
        var pre = document.createElement('pre');
        pre.textContent = links.join('\n');
        pre.style.cssText = 'margin:20px;font-family:monospace;white-space:pre-wrap;word-break:break-all';
        document.body.appendChild(pre);
    }

    ready(function() {
        getLinks().then(function(links) {
            if (!links.length) throw new Error();
            show(links);
        }).catch(function() {
            document.documentElement.innerHTML = 'Error';
        });
    });
})();