OtaviOu / Copiar links Downloadly

// ==UserScript==
// @name         Copiar links Downloadly
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  açalskdfj
// @author       eu
// @match        https://downloadlynet.ir/*
// @grant        GM_setClipboard
// @license      MIT
// ==/UserScript==


(function () {
  'use strict';

  function getDownloadLinks() {
    return Array.from(document.querySelectorAll('a'))
      .map(a => a.href)
      .filter(href =>
        href.includes('.rar') &&
        href.includes('?nocache=')
      );
  }

  function addCopyButton() {
    const btn = document.createElement('button');
    btn.textContent = '📥 Copiar links .rar';
    btn.style.position = 'fixed';
    btn.style.top = '10px';
    btn.style.right = '10px';
    btn.style.zIndex = 9999;
    btn.style.padding = '10px';
    btn.style.background = '#007bff';
    btn.style.color = '#fff';
    btn.style.border = 'none';
    btn.style.borderRadius = '6px';
    btn.style.fontSize = '14px';
    btn.style.cursor = 'pointer';
    btn.style.boxShadow = '0 2px 4px rgba(0,0,0,0.3)';

    btn.onclick = () => {
      const links = getDownloadLinks();
      if (links.length === 0) {
        alert('Nenhum link .rar com ?nocache= encontrado.');
      } else {
        GM_setClipboard(links.join('\n'));
        alert(`${links.length} link(s) copiado(s) para a área de transferência.`);
      }
    };

    document.body.appendChild(btn);
  }

  window.addEventListener('load', () => {
    setTimeout(addCopyButton, 1000);
  });
})();