PearCrypt Skip

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

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