Greasy Fork is available in English.

Suno AI Link Converter

Convert Suno AI links to direct audio links

  1. // ==UserScript==
  2. // @name Suno AI Link Converter
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4
  5. // @description Convert Suno AI links to direct audio links
  6. // @author w4t3r1ily
  7. // @match *://*/*
  8. // @include *
  9. // @grant none
  10. // @icon https://www.google.com/s2/favicons?sz=64&domain=suno.com
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Function to create the new link element with an arrow sign
  17. function createCDNLink(uuid) {
  18. const cdnLink = document.createElement('a');
  19. cdnLink.href = `https://cdn1.suno.ai/${uuid}.mp3`; // Construct the CDN URL using the UUID
  20. cdnLink.textContent = `⇒ https://cdn1.suno.ai/${uuid}.mp3`; // Set the text content of the link with an arrow sign
  21. return cdnLink; // Return the newly created link element
  22. }
  23.  
  24. // Get all anchor elements on the page
  25. const links = document.querySelectorAll('a');
  26.  
  27. // Iterate over each link
  28. links.forEach(link => {
  29. // Match the URL against the specific Suno AI pattern and extract the UUID
  30. const match = link.href.match(/https:\/\/(?:app\.suno\.ai|suno\.com)\/song\/([a-f0-9\-]{36})\/?/);
  31. if (match) {
  32. const uuid = match[1]; // Extract the UUID from the matched pattern
  33. const cdnLink = createCDNLink(uuid); // Create a CDN link using the extracted UUID
  34.  
  35. // Create a line break element
  36. const lineBreak = document.createElement('br');
  37.  
  38. // Insert the line break and then the new link below the original link
  39. link.insertAdjacentElement('afterend', lineBreak); // Insert the line break after the original link
  40. lineBreak.insertAdjacentElement('afterend', cdnLink); // Insert the new CDN link after the line break
  41. }
  42. });
  43. })();