Skip to content

Instantly share code, notes, and snippets.

@CrackerHax
Created October 29, 2024 06:46
Show Gist options
  • Select an option

  • Save CrackerHax/eea3885886d31ede4ec2f766d910cfa9 to your computer and use it in GitHub Desktop.

Select an option

Save CrackerHax/eea3885886d31ede4ec2f766d910cfa9 to your computer and use it in GitHub Desktop.
Suno bulk mp3 downloader from playlist
import requests
import re
# list of playlist urls
urls = ["https://suno.com/playlist/edb8082f-55a7-4ebb-be73-8f9d5c45a39b","https://suno.com/playlist/0244f6f0-7ce8-435f-a314-7965b191691f","https://suno.com/playlist/4e31aa88-552d-4d23-a1c9-5f9e61137b81","https://suno.com/playlist/c6e5b065-7537-41c6-b445-e5a537f4101e"]
# path for mp3s
mp3_path = "mp3/zombie/"
def extract_mp3_links(url):
response = requests.get(url)
if response.status_code != 200:
print("Failed to retrieve the page.")
return []
# Directly find all .mp3 URLs in the raw HTML text
mp3_links = re.findall(r'https?://[^\s\'"]+\.mp3', response.text)
return mp3_links
def save_links_to_file(links, filename):
if links:
with open(filename, 'w') as file:
for link in links:
file.write(link + '\n')
print(f"Links saved to {filename}")
else:
print("No links to save.")
def download_files(links):
for link in links:
if("None" not in link and "silence" not in link):
try:
response = requests.get(link)
response.raise_for_status() # Raise an error for bad responses
filename = link.split('/')[-1] # Get the file name from the URL
with open(mp3_path+filename, 'wb') as file:
file.write(response.content) # Write the content to the file
print(f"Downloaded: {filename}")
except requests.RequestException as e:
print(f"Failed to download {link}: {e}")
for url in urls:
mp3_links = extract_mp3_links(url)
download_files(mp3_links)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment