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.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

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