Media Link Extractor

Extract media links from various websites.

2025-01-09 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Media Link Extractor
// @namespace    http://tampermonkey.net/
// @version      3.1
// @description  Extract media links from various websites.
// @author       1axx
// @match        https://cyberdrop.me/*
// @match        https://files.fm/*
// @match        https://app.koofr.net/*
// @match        https://bunkr.site/*
// @match        https://bunkr.si/*
// @grant        GM_setClipboard
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    // Site configuration for selectors and processing
    const siteConfigs = {
        'cyberdrop.me': {
            selector: '.image-container.column a.image',
            process: (el) => el.getAttribute('href'),
        },
        'files.fm': {
            selector: '.item.file.image-item a.top_button_download.my_tooltip, .item.file.video-item a.top_button_download.my_tooltip',
            process: (el) => el.getAttribute('href'),
        },
        'app.koofr.net': {
            selector: 'a[href^="/content/links/"]',
            process: (el) => el.getAttribute('href'),
        },
        'bunkr.site': {
            selector: 'a[href^="https://bunkrrr.org/"]',
            process: (el) => el.getAttribute('href'),
        },
        'bunkr.si': {
            selector: 'a[href^="https://bunkrrr.org/"]',
            process: (el) => el.getAttribute('href'),
        },
    };

    let mediaLinks = new Set(); // Use a Set to avoid duplicates

    // Function to collect media links
    function collectMediaLinks() {
        const host = window.location.host;
        const config = siteConfigs[Object.keys(siteConfigs).find((key) => host.includes(key))];
        if (!config) {
            alert('Unsupported site.');
            return;
        }

        mediaLinks.clear(); // Clear previous links
        const elements = document.querySelectorAll(config.selector);
        elements.forEach((el) => {
            const link = config.process(el);
            if (link) {
                // Add the link to the Set
                mediaLinks.add(link.startsWith('http') ? link : `${window.location.origin}${link}`);
            }
        });
    }

    // Function to display the links
    function displayLinksUI() {
        const popup = document.createElement('div');
        popup.style.cssText = `
            position: fixed;
            top: 20%;
            left: 50%;
            transform: translate(-50%, -20%);
            background-color: #121212;
            padding: 20px;
            border: 2px solid #444;
            border-radius: 10px;
            z-index: 10000;
            width: 60%;
            box-shadow: 0px 0px 20px rgba(0, 255, 255, 0.3);
        `;

        const textarea = document.createElement('textarea');
        textarea.value = Array.from(mediaLinks).join('\n'); // Convert Set to Array and join with newlines
        textarea.style.cssText = `
            width: 100%;
            height: 200px;
            margin-bottom: 10px;
            background-color: #181818;
            color: #00FFFF;
            border: 1px solid #555;
            border-radius: 5px;
            padding: 10px;
            font-family: Consolas, "Courier New", monospace;
            font-size: 14px;
            resize: none;
        `;
        popup.appendChild(textarea);

        const counter = document.createElement('div');
        counter.textContent = `Total Unique Links: ${mediaLinks.size}`; // Show unique count
        counter.style.cssText = `
            margin-bottom: 10px;
            font-weight: bold;
            text-align: center;
            color: #00FFFF;
        `;
        popup.appendChild(counter);

        const copyButton = document.createElement('button');
        copyButton.textContent = 'Copy to Clipboard';
        copyButton.style.cssText = `
            padding: 10px;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        `;
        copyButton.addEventListener('click', () => {
            textarea.select();
            document.execCommand('copy');
            alert('Links copied to clipboard!');
        });
        popup.appendChild(copyButton);

        const closeButton = document.createElement('button');
        closeButton.textContent = 'Close';
        closeButton.style.cssText = `
            margin-left: 10px;
            padding: 10px;
            background-color: #dc3545;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        `;
        closeButton.addEventListener('click', () => {
            document.body.removeChild(popup);
        });
        popup.appendChild(closeButton);

        document.body.appendChild(popup);
    }

    // Add a button to trigger the process
    const extractButton = document.createElement('button');
    extractButton.textContent = 'Extract Media Links';
    extractButton.style.cssText = `
        position: fixed;
        top: 10px;
        right: 10px;
        z-index: 9999;
        background-color: #007bff;
        color: white;
        border: none;
        padding: 10px 15px;
        border-radius: 5px;
        cursor: pointer;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    `;
    extractButton.addEventListener('click', () => {
        collectMediaLinks();
        if (mediaLinks.size > 0) {
            displayLinksUI();
        } else {
            alert('No media links found! Make sure the content is fully loaded.');
        }
    });

    document.body.appendChild(extractButton);

    // Monitor for dynamic content loading
    const observer = new MutationObserver(() => {
        collectMediaLinks();
    });

    observer.observe(document.body, { childList: true, subtree: true });
})();