Как загрузить музыку из Shazam

How to download music from Shazam?

Hello everyone! I’m a big music lover – music has been with me my whole life. That’s probably why I often use the Shazam service – if I like a melody, I Shazam it to find out what wonderful tune is playing (even modern music sometimes has something that touches the soul). And then… What comes next?

Just recently, I logged into my Shazam account and was surprised to see that I had around 1,500 different songs in my list. The question arose – what to do? Search manually? That’s quite time-consuming and tedious for 1,500 songs. Automate the process? Where to download from? How to get a list of all saved songs from Shazam? No need to keep you in suspense – right now, while I’m writing this post, the download statistics are running on my second monitor. Here’s a screenshot of the process:
how to download music from Shazam

The code is a bit rough, and I’m running it directly in Sublime Text (I was interested in setting up a streaming workflow, so I didn’t compile it into an .exe file, plus there are still some tweaks needed). But the most important thing is – it works! So, how does it all happen?

### 1. Getting a list of saved songs from Shazam:
Let’s start with the basics – how to get a list of all saved songs from Shazam onto your computer? Just go to this link: https://www.shazam.com/ru/privacy/login/download and after seeing the following window:
save song list from Shazam to computer

log in. For example, my login is linked to my Google account, so I simply signed in through Google and, after seeing the next screen, manually entered my email address:
save song list from Shazam to computer

Click the “Send Data” button, and you’ll see a message stating that Shazam will send you all your saved data within 30 days. Don’t worry – I received mine in just two hours. The email contains a data.zip archive, which includes the following files:
– AnalyticsSongs.jsonl
– AnalyticsUsage.jsonl
– Installations.json
– README.pdf
– SyncedSongs.csv

I didn’t feel like digging into all the details (although looking at AnalyticsSongs.jsonl reveals a lot of interesting data!), so I just opened SyncedSongs.csv. That’s where the next step begins…

### 2. Creating a text file with artist and song title:
The content of SyncedSongs.csv follows this structure:

artist,"title","status","date","longitude","latitude"

Obviously, we’re interested in the artist and song title. You could use Python to trim unnecessary data, but why bother when Excel’s built-in tools work just fine? Here are two ways to open a CSV file so that values are placed in separate columns:

#### Method 1: Opening via Excel
– Open Excel.
– Go to the Data tab.
– Click “From Text/CSV” (in older versions: “Open” and select the CSV file).
– In the preview window, make sure the delimiter is set to “Comma”.
– Click “Load” or “OK” – the data will be split into columns.

#### Method 2: Using the “Text to Columns” wizard
– If the file is already open but all data appears in one column, select that column.
– Go to the Data tab.
– Click “Text to Columns”.
– Choose “Delimited” and click “Next”.
– Check “Comma” as the delimiter (make sure other delimiters are unchecked) and click “Next”.
– Click “Finish” – the data will be separated into columns.

Once we have the structured data, we remove unnecessary columns and save the remaining information as a text file. To save it as a text file:
– Click “File” → “Save As”
– Select “Text (Tab delimited)” .txt
– Save it. 🙂

Now we have a text file where each line contains the artist and song title, separated by a TAB. The next step is downloading the songs from Shazam.

### 3. Downloading the music:
To be clear – I couldn’t download songs directly from Shazam’s servers. Nor from Spotify, unfortunately… In theory, one could intercept the audio stream, but that would be a slow and cumbersome process. However, we do have YouTube, where almost everything is available. Even now, I’m listening to a YouTube track in my headphones:

(What do you think of this style?)

So I built on this idea and wrote a script that searches YouTube for each song and downloads it. The core of this script is the Python library yt_dlp. Another library used is tqdm for progress bars. Everything else is standard system libraries.

import yt_dlp  # Library for downloading audio/video from YouTube
from tqdm import tqdm  # Library for displaying a progress bar
import time
import os
import sys
# File containing the list of songs
song_list_file = "Song_list.txt"
# Log files
success_file = "success.txt"  # File for successfully downloaded songs
failed_file = "failed.txt"  # File for download errors
# Main loop for processing songs
while True:
# Read the list of songs from the file
with open(song_list_file, "r", encoding="utf-8") as file:
songs = file.readlines()
# If the list is empty, exit the loop
if not songs:
break
# Take the first song from the list
song = songs[0].strip()
if not song:  # Skip empty lines
songs.pop(0)
continue
# Split the line into artist and song title
try:
artist, title = song.split("\t", 1)  # Tab-separated values
except ValueError:  # If format is incorrect, log the error
with open(failed_file, "a", encoding="utf-8") as failed_log:
failed_log.write(f"{song} - Invalid format\n")
songs.pop(0)
continue
# Create a search query for YouTube
query = f"{artist} {title}"
# Define the output file path
output_filename = f"downloads/{artist} - {title}.mp3"
# Create the downloads folder if it doesn't exist
os.makedirs("downloads", exist_ok=True)
# yt-dlp settings for downloading audio
ydl_opts = {
"format": "bestaudio/best",  # Select the best available audio quality
"outtmpl": f"downloads/{artist} - {title}.%(ext)s",  # Output filename format
"quiet": True,  # Suppress extra console output
"postprocessors": [{  # Convert to MP3 after download
"key": "FFmpegExtractAudio",
"preferredcodec": "mp3",
"preferredquality": "192",
}],
"progress_hooks": [],  # Hook for updating progress
"noprogress": True,  # Disable yt-dlp's default progress display
}
print(f"\n🔍 Searching: {query}")
# Create a progress bar
pbar = tqdm(total=100, desc=f"Downloading {query}", ncols=100, unit="%", dynamic_ncols=True, file=sys.stdout)
def progress_hook(d):
"""Function to update the download progress"""
if d["status"] == "downloading":
percent_str = d.get("_percent_str", "0.0%").strip("%")
try:
percent = float(percent_str)
pbar.update(percent - pbar.n)  # Update progress bar
except ValueError:
pass
elif d["status"] == "finished":
pbar.n = 100
pbar.update(0)
pbar.close()
# Add the progress hook to yt-dlp options
ydl_opts["progress_hooks"].append(progress_hook)
try:
# Start the download process using yt-dlp
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
ydl.download([f"ytsearch:{query}"])  # Search and download
# Check if the file was created
if os.path.exists(output_filename):
with open(success_file, "a", encoding="utf-8") as success_log:
success_log.write(f"{query}\n")
print(f"\r✅ Successfully downloaded: {query}{' ' * 30}")
else:
with open(failed_file, "a", encoding="utf-8") as failed_log:
failed_log.write(f"{query} - Conversion error\n")
print(f"\r❌ Conversion error: {query}{' ' * 30}")
except Exception as e:
# Log the download error
with open(failed_file, "a", encoding="utf-8") as failed_log:
failed_log.write(f"{query} - {str(e)}\n")
print(f"\r❌ Download error: {query} - {e}{' ' * 30}")
# Remove the processed song from the list
songs.pop(0)
with open(song_list_file, "w", encoding="utf-8") as file:
file.writelines(songs)
time.sleep(1)  # Short delay before the next download
print("\n🎵 Download completed! Successful downloads are in success.txt, errors in failed.txt.")

Download the .py file here. 🙂

I hope this helps you download songs from your saved Shazam list! As always, if you have any questions, feel free to email me at this address or message me on Telegram.

And yes, a graphical interface app that will let you save your Shazam music easily – coming soon! 😀

Support the Blog!

Running a blog takes a lot of effort, time, and passion. Your donations help improve the content, inspire new ideas, and keep the project going.
If you’ve enjoyed the blog’s materials, any support would mean the world to me. Thank you for being here! ❤️

PayPal Logo Donate via PayPal

Revolut Logo Donate via Revolut

Leave a Reply

Your email address will not be published. Required fields are marked *