nascent / Remix Rotation Get Music

// ==UserScript==
// @name        Remix Rotation Get Music
// @namespace   http://remixrotation.com/
// @version     0.3
// @description Get list of full-length music from remix rotation
// @author      nascent
// @match       *://remixrotation.com/*
// @grant       GM_addStyle
// @license     GPL-3.0-or-later
// @updateURL   https://openuserjs.org/meta/nascent/Remix_Rotation_Get_Music.meta.js
// @downloadURL https://openuserjs.org/install/nascent/Remix_Rotation_Get_Music.user.js
// @icon        https://www.google.com/s2/favicons?domain=remixrotation.com&sz=128
// ==/UserScript==
(function() {
    'use strict';

    GM_addStyle("button#rr-get-music { margin-top: 0px; line-height: 20px; font-weight: bold; padding: 0 40px; background: var(--bs-primary); color: white; border: none; filter: brightness(1); } button#rr-get-music:hover { background: color-mix(in srgb, var(--bs-primary) 100%, black 30%); cursor: pointer; }");

    const button = document.createElement("button");
    button.id = "rr-get-music";
    button.textContent = "Get Youtube Links";
    const headerContainer = document.querySelector("header .container");
    headerContainer.insertBefore(button, headerContainer.firstChild);

    button.addEventListener("click", function() {
        let output = "";

        document.querySelectorAll("#playlist tr td:first-child").forEach(function(td) {
            const match = td.innerHTML.match(/data-song-url="(.+?)"/);
            if (match) {
                console.log(match[1]);
                output += " " + match[1];
            }
        });

        const link = document.createElement("a");
        link.setAttribute("href", "data:text/plain," + output);
        link.setAttribute("download", "music.txt");
        link.click();
    });
})();