Skip to content

Instantly share code, notes, and snippets.

@Axenide
Created August 2, 2024 07:05
Show Gist options
  • Save Axenide/cd973f5e8edd8640f1c9a77d7b78b510 to your computer and use it in GitHub Desktop.
Save Axenide/cd973f5e8edd8640f1c9a77d7b78b510 to your computer and use it in GitHub Desktop.
Bulk download your Suno songs and videos!

How to bulk download your Suno library

Today my dad asked me for a way to download all of his Suno songs. (He really loves writing songs, and now he can give them life easily. What a time to be alive!). Luckily, I found this gist and it works great, but my dad also wanted to get the videos generated, so I modified it a little.

copy(
    [...$('[role="grid"]')[Object.keys($('[role="grid"]')).filter(x => x.startsWith('__reactProps'))[0]].children[0].props.values[0][1].collection]
    .reduce((acc, x) => {
        if (x.value.audio_url) acc.push(x.value.audio_url);
        if (x.value.video_url) acc.push(x.value.video_url);
        return acc;
    }, [])
    .join('\n')
)

You just open your browser console and paste it.

What this does is copying the links of all the songs currently displayed in your library, you can save them wherever you want and use your download manager of choice. Personally I used wget, it is this simple:

wget -i urls.txt

If you want to just get your urls.txt, this version saves it automatically for you (but you will have your links in different files for each page of your library):

let links = 
    [...$('[role="grid"]')[Object.keys($('[role="grid"]')).filter(x => x.startsWith('__reactProps'))[0]].children[0].props.values[0][1].collection]
    .reduce((acc, x) => {
        if (x.value.audio_url) acc.push(x.value.audio_url);
        if (x.value.video_url) acc.push(x.value.video_url);
        return acc;
    }, [])
    .join('\n');

let blob = new Blob([links], { type: 'text/plain' });

let a = document.createElement('a');
a.href = URL.createObjectURL(blob);
a.download = 'urls.txt';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
@sleepingcat4
Copy link

@killmark-prog did you try scraping this page? It seems to be strictly guarded by Cloudfare

https://suno.com/search?type=public_song

@sleepingcat4
Copy link

if anyone searching for getting list of playlists, can use this following code

javascript:(function() {
    try {
      const playlistLinks = new Set();
      const anchors = document.querySelectorAll('a[href^="/playlist/"]');
  
      anchors.forEach(a => {
        const href = a.getAttribute('href');
        if (href && /^\/playlist\/[0-9a-f\-]{36}$/.test(href)) {
          playlistLinks.add(`https://suno.com${href}`);
        }
      });
  
      if (!playlistLinks.size) throw new Error("No playlist links found.");
      copy([...playlistLinks].join('\n'));
      alert(`Copied ${playlistLinks.size} playlist link(s) to clipboard.`);
  
    } catch (error) {
      console.error("Suno Playlist Scraper Error:", error);
      alert("Error: " + error.message);
    }
  })()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment