Myrient Collect Links with Filters

Collect, filter links, and then copy to your clipboard with a single button click. filters for links containing "(USA)" and excludes "(demo)" and "(kiosk)". Is fairly easy to modify.

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

Bạn sẽ cần cài đặt một tiện ích mở rộng như Tampermonkey hoặc Violentmonkey để cài đặt kịch bản này.

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

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

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

You will need to install a user script manager extension to install this script.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Myrient Collect Links with Filters
// @version      1.0
// @description  Collect, filter links, and then copy to your clipboard with a single button click. filters for links containing "(USA)" and excludes "(demo)" and "(kiosk)". Is fairly easy to modify.
// @author       Dethkiller15 & ChatGPT
// @match        https://myrient.erista.me/files/*
// @grant        GM_addStyle
// @grant        GM_setClipboard
// @license      MIT
// @namespace https://greasyfork.org/users/994690
// ==/UserScript==

// Note: This is meant to be used with a urls.txt downloader.(something that can batch download urls inside a .txt file) its fairly easy to make one yourself with chatgpt using a .bat or .sh file if you dont want to install one.

(function() {
    'use strict';

    // Add button to the bottom-left of the screen
    const button = document.createElement('button');
    button.textContent = "Copy Links";
    button.id = "copy-links-btn";
    document.body.appendChild(button);

    // Style the button
    GM_addStyle(`
        #copy-links-btn {
            position: fixed;
            bottom: 10px;
            left: 10px;
            z-index: 9999;
            padding: 10px 20px;
            background-color: #007BFF;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
            font-size: 14px;
        }
        #copy-links-btn:hover {
            background-color: #0056b3;
        }
    `);

    // Button click event
    button.addEventListener('click', () => {
        const pageUrl = window.location.origin;
        const links = [...document.querySelectorAll('a[href][title]')]
            .filter(link =>
                link.title.toLowerCase().includes("(usa)") &&
                !link.title.toLowerCase().includes("(demo)") &&
                !link.title.toLowerCase().includes("(kiosk)")
            )
            .map(link => new URL(link.href, pageUrl).href);

        // Copy links to clipboard
        if (links.length > 0) {
            GM_setClipboard(links.join('\n'), { type: 'text', mimetype: 'text/plain' });
            alert(`Copied ${links.length} link(s) to clipboard!`);
        } else {
            alert("No matching links found.");
        }
    });
})();