Greasy Fork

来自缓存

Greasy Fork is available in English.

🚀 Dcard 資源採集 (V10.3 網址黑名單過濾版)

精準排除 r2limit2 等廣告域名圖,鎖定真正的使用者影片/原圖

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         🚀 Dcard 資源採集 (V10.3 網址黑名單過濾版)
// @namespace    http://tampermonkey.net/
// @version      10.3
// @description  精準排除 r2limit2 等廣告域名圖,鎖定真正的使用者影片/原圖
// @author       Gemini_Adaptive
// @match        https://www.dcard.tw/f/sex*
// @match        https://lurl.cc/*
// @match        https://myppt.cc/*
// @grant        window.close
// @grant        GM_openInTab
// @require      https://code.jquery.com/jquery-3.6.0.min.js
// ==/UserScript==

(function() {
    'use strict';

    const currentHost = window.location.host;

    function getMMDD(text) {
        const match = text.match(/(\d{4})[-/](\d{2})[-/](\d{2})/);
        return match ? match[2] + match[3] : null;
    }

    // ==================== [1] Dcard 頁面邏輯 ====================
    if (currentHost.includes('dcard.tw')) {
        const $btn = $('<button id="batch-dl-btn">🚀 批次開啟任務</button>').css({
            position: 'fixed', bottom: '30px', right: '30px', zIndex: 99999,
            padding: '16px 28px', backgroundColor: '#006aa6', color: 'white',
            border: 'none', borderRadius: '50px', cursor: 'pointer', fontWeight: 'bold'
        });
        $btn.on('click', () => {
            const links = [...new Set($('a[href*="lurl.cc"], a[href*="myppt.cc"]').map((i, el) => el.href).get())];
            if (links.length === 0) return alert('找不到連結,請先載入留言!');
            links.forEach((url, i) => {
                setTimeout(() => GM_openInTab(url, { active: false }), i * 1500);
            });
        });
        $('body').append($btn);
    }

    // ==================== [2] Lurl / Myppt 邏輯 ====================
    if (currentHost.match(/lurl\.cc|myppt\.cc/)) {

        // 檢查解鎖狀態
        const pageText = $('body').text();
        if (pageText.includes('密碼錯誤') || pageText.includes('Password Error')) {
            $('body').prepend('<div style="background:red;color:white;padding:10px;text-align:center;font-weight:bold;z-index:999999;position:relative;">⚠️ 自動解鎖失敗:請手動輸入 ⚠️</div>');
            return;
        }

        const dateText = $('.login_span').text();
        const mmdd = getMMDD(dateText);

        // 自動解鎖
        if (currentHost.includes('lurl.cc')) {
            const pathId = window.location.pathname.replace('/', '');
            if (mmdd && !document.cookie.includes(`psc_${pathId}`)) {
                document.cookie = `psc_${pathId}=${mmdd}; path=/`;
                location.reload(); return;
            }
        }
        if (currentHost.includes('myppt.cc') && $('#pasahaicsword').length > 0 && mmdd) {
            $('#pasahaicsword').val(mmdd);
            $('button[type="submit"], #main_fjim60unBU').click(); return;
        }

        // --- 資源偵測與「黑名單」過濾 ---
        let scanCount = 0;
        const cleaner = setInterval(() => {
            scanCount++;

            const $video = $('video');
            const $img = $('img').filter((i, el) => {
                const src = el.src.toLowerCase();

                // 【黑名單過濾條件】
                const isBlockedDomain = src.includes('r2limit2.lurl.cc'); // 你提供的廣告圖域名
                const isLogo = src.includes('logo') || src.includes('icon') || src.includes('banner');
                const isPlaceholder = el.naturalWidth === 800 || el.naturalWidth < 200;

                return !isBlockedDomain && !isLogo && !isPlaceholder;
            });

            if ($video.length > 0 || $img.length > 0) {
                clearInterval(cleaner);

                const videoSrc = $video.find('source').attr('src') || $video.attr('src');
                const imgSrcs = $img.map((i, el) => el.src).get();

                if (videoSrc || imgSrcs.length > 0) {
                    $('body').empty().css({
                        'background-color': '#000', 'color': '#fff', 'text-align': 'center', 'padding': '20px'
                    });

                    if (videoSrc) {
                        const $newVid = $('<video controls autoplay style="max-width:95vw; max-height:85vh; border: 2px solid #444;">')
                            .append($('<source>').attr('src', videoSrc));
                        $('body').append($newVid).append('<p>🎥 影片原檔 (右鍵另存)</p>');
                    }

                    imgSrcs.forEach(src => {
                        $('body').append($('<img>').attr('src', src).css({
                            'max-width': '95vw', 'margin-bottom': '20px', 'border': '1px solid #333'
                        })).append('<br>');
                    });

                    $('body').append($('<button>✕ 關閉分頁</button>').css({
                        'position': 'fixed', 'top': '10px', 'right': '10px', 'padding': '8px'
                    }).on('click', () => window.close()));
                }
            }

            if (scanCount > 15) clearInterval(cleaner);
        }, 1000);
    }
})();