Skip to content

Instantly share code, notes, and snippets.

@jakedowns
Last active March 14, 2024 23:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakedowns/6ab436a8761079e7211be6478928df5a to your computer and use it in GitHub Desktop.
Save jakedowns/6ab436a8761079e7211be6478928df5a to your computer and use it in GitHub Desktop.
bulk suno library export
Array.from(document.querySelectorAll('[data-clip-id]')).map((a)=>{return a.getAttribute('data-clip-id')})
file_ids = [
]
import os
import requests
# Base URL for the files
base_url = "https://cdn1.suno.ai/"
# How many files are we about to download?
print(f"About to download {len(file_ids)} files. X 2 (audio and video)")
for file_id in file_ids:
audio_url = f"{base_url}{file_id}.mp3"
video_url = f"{base_url}{file_id}.mp4"
# Check if the audio file exists
audio_file_name = audio_url.split('/')[-1]
if not os.path.exists(audio_file_name):
print(f"Downloading {audio_file_name}...")
response = requests.get(audio_url)
if response.status_code == 200:
with open(audio_file_name, 'wb') as file:
file.write(response.content)
print(f"Downloaded {audio_file_name}.")
else:
print(f"Failed to download {audio_file_name}. HTTP status code: {response.status_code}")
else:
print(f"Audio file {audio_file_name} already exists. Skipping.")
# Check if the video file exists
video_file_name = video_url.split('/')[-1]
if not os.path.exists(video_file_name):
print(f"Downloading {video_file_name}...")
response = requests.get(video_url)
if response.status_code == 200:
with open(video_file_name, 'wb') as file:
file.write(response.content)
print(f"Downloaded {video_file_name}.")
else:
print(f"Failed to download {video_file_name}. HTTP status code: {response.status_code}")
else:
print(f"Video file {video_file_name} already exists. Skipping.")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment