您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add download icons for songs on Suno.ai
当前为
// ==UserScript== // @name Download Icon Adder for Suno.ai // @name:en Download Icon Adder for Suno.ai // @namespace http://tampermonkey.net/ // @version 0.1.3.1 // @description Add download icons for songs on Suno.ai // @description:en Add download icons for songs on Suno.ai // @author aspen138 // @match *://*.suno.ai/* // @match *://suno.com/* // @grant none // @icon https://www.google.com/s2/favicons?sz=64&domain=suno.ai // @license MIT // ==/UserScript== (function() { 'use strict'; // Function to create a download button function createDownloadButton(downloadURL, fileType) { let button = document.createElement('button'); button.innerText = fileType.toUpperCase(); button.onclick = function() { window.open(downloadURL, '_blank').focus(); }; button.style.marginLeft = '5px'; button.style.fontSize = '12px'; button.style.padding = '5px'; return button; } // Function to extract song ID and add download buttons function addDownloadButtons() { // Updated regex pattern to correct the domain name and match the song ID const regexPattern = /https:\/\/suno\.com\/song\/([a-zA-Z0-9-]+)/; // Updated cssSelector for matching the element to append the download button const cssSelector= '.chakra-stack.css-8g8ihq > .chakra-stack.css-130bjmo'; document.querySelectorAll(cssSelector).forEach(function(element) { let match = regexPattern.exec(window.location.href); if (match && match[1] && !element.dataset.downloadsAdded) { let songId = match[1]; let mp3DownloadURL = `https://cdn1.suno.ai/${songId}.mp3`; let mp4DownloadURL = `https://cdn1.suno.ai/${songId}.mp4`; let mp3Button = createDownloadButton(mp3DownloadURL, 'mp3'); let mp4Button = createDownloadButton(mp4DownloadURL, 'mp4'); element.appendChild(mp3Button); element.appendChild(mp4Button); element.dataset.downloadsAdded = true; // Mark the element to prevent duplicate buttons } }); } // MutationObserver to handle dynamic content loading const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.type === 'childList') { addDownloadButtons(); // Re-run when DOM changes are detected } }); }); // Specify what to observe const config = { childList: true, subtree: true }; // Start observing the body for changes observer.observe(document.body, config); // Initial invocation addDownloadButtons(); })();