Mini python script to demonstrate how spotify can be cleverly worked around to get the songs in a playlist
- Download the script and the requirements. You need to have Git installed.
git clone https://github.com/inmicro/spotify-playlist-dl
- Get your spotify developer api credentials. Create a new application, put some info in it and then copy the Client ID and client secret
- CD into the directory:
cd spotify-playlist-dl
- Download the requirements
pip install -r requirements.txt
- Run the script, with your first argument being the URL of the spotify playlist you want:
python3 main.py -m <mode> -u <spotify> URL
Check #flags to see all the available flags 6. It will ask for your credentials. Put them appropriately. Move the songs in the music directory away after the script has finished running.
- You can create a file named
creds
and put in the client_id on the first line and client_secret on the second and it won't ask for creds each time
-m / --mode <playlist/track> (REQUIRED) -> Sets mode to playlist or track. For downloading individual track, set: -m track
for downloading playlist, set : -m playlist
for downloading top songs from artist, set : -m artist
-u / --url <URL of Playlist/Track> (REQUIRED) -> To set the URL of the playlist/track/artist which you want to get.
-s / --storeformat <zip/folder> (OPTIONAL) -> For playlists only. sets the format of how the final music should be stored, in a zipfile or in a folder. By default folder
-q / --quality <320k/128k/medium/insane> (Optional) -> Sets quality of ffmpeg encoded file. insane and 320k are the same thing. Same for 128k and medium. By default set to 192K
-h / --help -> Prints out detailed description of all flags and how to use them.
-n / --number (Optional) => relevant for artists mode only. Sets the number of top songs to download
$ python main.py --mode playlists --url <url of playlist> --storeformat zip
$ python main.py --mode track --url <track url>
$ python main.py --mode artist --url <artist url> --number 9 --quality 128k
I do not condone piracy of any type. I personally buy all the music that I like from iTunes. This script is just for educational purposes(ie is a nice hack)
Check out vaimer9's osm rewrite: https://github.com/Vaimer9/detach Try it out too! (The code is much nicer and easier to hack around)
edit: he uses cursed strong typing. don't bother
To the people who made spotipy, yt-dl and the contributors :)(Also the musicians)