☰

WPD Media Unlock

Bypasses age gates, unblurs media, replaces videos with static images, and adds download/preview controls

Tendrás que instalar una extensión para tu navegador como Tampermonkey, Greasemonkey o Violentmonkey si quieres utilizar este script.

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

Tendrás que instalar una extensión como Tampermonkey o Violentmonkey para instalar este script.

Necesitarás instalar una extensión como Tampermonkey o Userscripts para instalar este script.

Tendrás que instalar una extensión como Tampermonkey antes de poder instalar este script.

Necesitarás instalar una extensión para administrar scripts de usuario si quieres instalar este script.

(Ya tengo un administrador de scripts de usuario, déjame instalarlo)

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Tendrás que instalar una extensión como Stylus antes de poder instalar este script.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

Para poder instalar esto tendrás que instalar primero una extensión de estilos de usuario.

(Ya tengo un administrador de estilos de usuario, déjame instalarlo)

// ==UserScript==
// @name         WPD Media Unlock
// @namespace    https://tampermonkey.net/
// @version      4.0
// @description  Bypasses age gates, unblurs media, replaces videos with static images, and adds download/preview controls
// @author       Syz7
// @license      MIT
// @match        *://*.watchpeopledie.tv/*
// @match        *://*.watchpeoplelive.tv/*
// @icon         data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48Y2lyY2xlIGN4PSI1MCIgY3k9IjUwIiByPSI0NiIgZmlsbD0iIzFlMWUyNCIgc3Ryb2tlPSIjNmE0YzkzIiBzdHJva2Utd2lkdGg9IjYiLz48dGV4dCB4PSI1MCIgeT0iNjgiIGZvbnQtZmFtaWx5PSJBcmlhbCIgZm9udC1zaXplPSI1NSIgZm9udC13ZWlnaHQ9IjkwMCIgZmlsbD0iI2ZmZiIgdGV4dC1hbmNob3I9Im1pZGRsZSI+VzwvdGV4dD48L3N2Zz4=
// @grant        GM_addStyle
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_registerMenuCommand
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    // ==========================================
    // 1. TRANSLATIONS & SETTINGS
    // ==========================================
    const translations = {
        en: { download: '⬇ Download', tooltip: 'Open original in a new tab' },
        ru: { download: '⬇ Скачать', tooltip: 'Открыть оригинал в новой вкладке' },
        zh: { download: '⬇ 下载', tooltip: '在新标签页中打开原图' },
        es: { download: '⬇ Descargar', tooltip: 'Abrir original en una nueva pestaña' },
        fr: { download: '⬇ Télécharger', tooltip: 'Ouvrir l\'original dans un nouvel onglet' },
        de: { download: '⬇ Herunterladen', tooltip: 'Original in neuem Tab öffnen' }
    };

    // Check if enabled (default true)
    let isEnabled = GM_getValue('wpd_enabled', true);
    
    // Get language (default system -> fallback to 'en')
    let currentLang = GM_getValue('wpd_lang');
    if (!currentLang) {
        const sysLang = navigator.language.split('-')[0];
        currentLang = translations[sysLang] ? sysLang : 'en';
        GM_setValue('wpd_lang', currentLang);
    }
    const dict = translations[currentLang] || translations['en'];

    // ==========================================
    // 2. TAMPERMONKEY MENU GUI
    // ==========================================
    GM_registerMenuCommand(
        isEnabled ? `🟢 Status: ON (Click to disable)` : `🔴 Status: OFF (Click to enable)`, 
        () => {
            GM_setValue('wpd_enabled', !isEnabled);
            location.reload(); // Reload to apply changes
        }
    );

    GM_registerMenuCommand(`🌐 Language: ${currentLang.toUpperCase()} (Click to change)`, () => {
        const msg = "Enter language code:\n\nen - English\nru - Русский\nzh - 中文\nes - Español\nfr - Français\nde - Deutsch";
        const newLang = prompt(msg, currentLang);
        
        if (newLang && translations[newLang.toLowerCase()]) {
            GM_setValue('wpd_lang', newLang.toLowerCase());
            location.reload(); // Reload to apply new language
        } else if (newLang) {
            alert("Unsupported language code. Defaulting to EN.");
        }
    });

    // If disabled, stop execution here
    if (!isEnabled) return;

    // ==========================================
    // 3. SAFE CSS INJECTION
    // ==========================================
    GM_addStyle(`
        /* Neutralize inline and CSS filters on media */
        img, video, picture, .post-linked-img, .img, .uk-age-parent {
            filter: none !important;
            -webkit-filter: none !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }

        /* Hide the mosaic overlay and age badges securely */
        #uk-age-mosaic, .uk-age-badge, #ukAgeGateModal {
            display: none !important;
            visibility: hidden !important;
            opacity: 0 !important;
            pointer-events: none !important;
        }

        /* Hide quality selectors that are useless for static images */
        .qualitySelector {
            display: none !important;
        }

        /* Download button styling */
        .wpd-download-btn {
            position: absolute !important;
            bottom: 10px !important;
            right: 10px !important;
            background: rgba(20, 20, 25, 0.85) !important;
            color: #fff !important;
            padding: 5px 10px !important;
            border-radius: 6px !important;
            text-decoration: none !important;
            font-size: 13px !important;
            font-weight: 500 !important;
            z-index: 9999 !important;
            opacity: 0;
            transition: opacity 0.2s !important;
            pointer-events: auto !important;
            cursor: pointer !important;
            border: 1px solid rgba(255, 255, 255, 0.2) !important;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
        }

        .wpd-img-wrapper:hover .wpd-download-btn {
            opacity: 1 !important;
        }

        /* Custom full-size preview modal */
        #wpd-custom-modal {
            display: none;
            position: fixed !important;
            top: 0 !important; left: 0 !important;
            width: 100vw !important; height: 100vh !important;
            background: rgba(0,0,0,0.95) !important;
            z-index: 9999999 !important;
            justify-content: center !important;
            align-items: center !important;
            cursor: zoom-out !important;
        }
        #wpd-custom-modal img {
            max-width: 95vw !important;
            max-height: 95vh !important;
            object-fit: contain !important;
            filter: none !important;
            cursor: default !important;
        }
    `);

    // ==========================================
    // 4. CORE LOGIC
    // ==========================================

    // Neutralize the media access script attribute
    function patchMediaAccess() {
        const accessScript = document.getElementById('media-access-script');
        if (accessScript) {
            accessScript.setAttribute('data-allowed', 'true');
        }
    }

    // Clean inline filter styles
    function cleanInlineFilters() {
        document.querySelectorAll('img, video, .uk-age-parent').forEach(el => {
            if (el.style) {
                el.style.removeProperty('filter');
                el.style.removeProperty('-webkit-filter');
                el.style.removeProperty('backdrop-filter');
                el.style.removeProperty('-webkit-backdrop-filter');
            }
        });
    }

    // Convert all videos to static images (posters)
    function convertVideosToImages() {
        document.querySelectorAll('video:not(.wpd-hidden-video)').forEach(video => {
            const poster = video.getAttribute('poster');
            
            if (poster) {
                const img = document.createElement('img');
                img.src = poster;
                img.className = 'post-linked-img img';
                img.style.cssText = 'max-width: 100%; height: auto; display: block; cursor: pointer;';
                video.parentNode.replaceChild(img, video);
            } else {
                video.style.display = 'none';
                video.classList.add('wpd-hidden-video');
            }
        });
    }

    // Intercept clicks for full-size preview
    function setupPreview() {
        if (document.body.dataset.wpdPreviewBound === 'true') return;
        document.body.dataset.wpdPreviewBound = 'true';

        const modal = document.createElement('div');
        modal.id = 'wpd-custom-modal';
        modal.innerHTML = '<img src="" alt="Preview">';
        modal.addEventListener('click', (e) => {
            if (e.target.tagName !== 'IMG') {
                modal.style.display = 'none';
                modal.querySelector('img').src = '';
            }
        });
        document.body.appendChild(modal);

        document.body.addEventListener('click', (e) => {
            const img = e.target.closest('img');
            // Ignore avatars, emojis, and download buttons
            if (!img || e.target.closest('.wpd-download-btn')) return;
            if (img.src.includes('l.webp') || img.src.includes('default_text')) return;
            if (img.classList.contains('emoji') || img.width < 100) return;

            e.preventDefault();
            e.stopPropagation();

            if (e.altKey) {
                window.open(img.src, '_blank');
                return;
            }
            modal.querySelector('img').src = img.src;
            modal.style.display = 'flex';
        }, true);

        document.addEventListener('keydown', (e) => {
            if (e.key === 'Escape') {
                modal.style.display = 'none';
                modal.querySelector('img').src = '';
            }
        });
    }

    // Wrap media to attach download buttons
    function processMedia() {
        document.querySelectorAll('.post-body img, .img').forEach(img => {
            if (img.closest('.wpd-img-wrapper')) return;
            if (img.src.includes('l.webp') || img.classList.contains('emoji')) return;

            const wrapper = document.createElement('div');
            wrapper.className = 'wpd-img-wrapper';
            wrapper.style.position = 'relative';
            wrapper.style.display = 'inline-block';
            img.parentNode.insertBefore(wrapper, img);
            wrapper.appendChild(img);

            const btn = document.createElement('a');
            btn.className = 'wpd-download-btn';
            btn.href = img.src;
            btn.target = '_blank';
            btn.rel = 'noopener';
            btn.textContent = dict.download;
            btn.title = dict.tooltip;
            wrapper.appendChild(btn);
        });
    }

    // Execution loop
    function run() {
        patchMediaAccess();
        cleanInlineFilters();
        convertVideosToImages(); // Converts videos to images before processing
        processMedia();
    }

    // Initial run
    run();
    setupPreview();

    // Observe DOM changes (e.g., infinite scroll) and process dynamically
    const observer = new MutationObserver(() => {
        run();
    });
    observer.observe(document.body, { childList: true, subtree: true });

    // Periodic safety net for late re-injected styles
    setInterval(cleanInlineFilters, 1500);

})();