# Deezer Music Downloader 🎶

**URL:** <https://onehack.st/t/deezer-music-downloader/217097>\
**Category:** Tools & Scripts\
**Tags:** tools, freebies, audio, downloaders\
**Created:** [March 23, 2022, 9:17pm UTC](https://onehack.st/t/deezer-music-downloader/217097 "2022-03-23T21:17:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aina](https://onehack.st/user_avatar/onehack.st/aina/32/167469_2.png) [@Aina](https://onehack.st/u/Aina)\
**Post date:** [March 23, 2022, 9:17pm UTC](https://onehack.st/t/deezer-music-downloader/217097/1 "2022-03-23T21:17:02Z")

</div>

![image](https://onehack.st/uploads/default/original/3X/d/4/d4c6c0bc05e89b182c7375544cec6affc1282e1b.png)

## Music Downloader 🎶 🎧 💃 🦄

[![tests](https://github.com/kmille/deezer-downloader/workflows/tests/badge.svg)](https://github.com/kmille/deezer-downloader/workflows/tests/badge.svg) [![push image to dockerhub](https://github.com/kmille/deezer-downloader/workflows/push%20to%20dockerhub/badge.svg)](https://github.com/kmille/deezer-downloader/workflows/push%20to%20dockerhub/badge.svg) [![docker pulls](https://camo.githubusercontent.com/1307aab6ea67366f27176ee6d9bf1ec12bef8fe843ce7c2d7850036bd5ee4fe4/68747470733a2f2f696d672e736869656c64732e696f2f646f636b65722f70756c6c732f6b6d696c6c65322f6465657a65722d646f776e6c6f61646572)](https://camo.githubusercontent.com/1307aab6ea67366f27176ee6d9bf1ec12bef8fe843ce7c2d7850036bd5ee4fe4/68747470733a2f2f696d672e736869656c64732e696f2f646f636b65722f70756c6c732f6b6d696c6c65322f6465657a65722d646f776e6c6f61646572) [![latest tag](https://camo.githubusercontent.com/08463bea8e091e77aa1b534ebf946ed6fd897f244825ddc773961730b200b21a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f6b6d696c6c652f6465657a65722d646f776e6c6f616465723f736f72743d73656d766572)](https://camo.githubusercontent.com/08463bea8e091e77aa1b534ebf946ed6fd897f244825ddc773961730b200b21a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f6b6d696c6c652f6465657a65722d646f776e6c6f616465723f736f72743d73656d766572) [![Python 3.6](https://camo.githubusercontent.com/56ff47d1f83018ec32bff7010c21e7da306df8606f093456b9e024a5830ce718/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f707974686f6e2d2533453d332e362d626c75652e737667)](https://camo.githubusercontent.com/56ff47d1f83018ec32bff7010c21e7da306df8606f093456b9e024a5830ce718/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f707974686f6e2d2533453d332e362d626c75652e737667)

### Features

- download songs, albums, public playlists from [Deezer.com](http://Deezer.com) (account is required, free plan is enough)
- download Spotify playlists (by parsing the Spotify website and download the songs from Deezer)
- download as zip file (including m3u8 playlist file)
- 320 kbit/s mp3s with ID3-Tags and album cover (UPDATE: right now only 128bkit/s mp3 works, see [#66](https://github.com/kmille/deezer-downloader/issues/66))
- download songs via yt-dlp
- KISS front end
- MPD integration (use it on a Raspberry Pi!)
- simple REST api

### How to use it

There is a settings file template called `settings.ini.example`. You can specify the download directory with `download_dir`. Pressing the download button only downloads the song/album/playlist. If you set `use_mpd=True` in the `settings.ini` the backend will connect to mpd (localhost:6600) and update the music database. Pressing the play button will download the music. If `use_mpd=True` is set the mpd database will be updated and the song/album/playlist will be added to the playlist. In `settings.ini` `music_dir` should be the music root location of mpd. The `download_dir` must be a subdirectory of `music_dir`.

As Deezer sometimes requires a captcha to login the auto login features was removed. Instead you have to manually insert a valid Deezer cookie to the `settings.ini`. The relevant cookie is the `arl` cookie.

### Run it as a service

We use it with nginx and [ympd](https://github.com/notandy/ympd) as mpd frontend

- / goes to ympd
- /d/ goes to the downloader

The deployment directory contains a systemd unit file and a nginx vhost config file. There is also a [patch](https://github.com/kmille/music-ansible/blob/master/roles/ympd/files/fix_header.patch) to add a link to the ympd frontend. The `debug` tab will show you the debug output of the app.

### Try it out

vagrant up vagrant ssh sudo vim /opt/deezer/app/settings.ini # insert your Deezer cookie /opt/deezer/app/venv/bin/python /opt/deezer/app/app.py # start the backend # On the host: xdg-open [http://localhost:5000](http://localhost:5000) # view frontend in the browser ncmpcpp -h 127.0.0.1 # try the mpd client

### Docker

You can use the Docker image hosted on [hub.docker.com](https://hub.docker.com/r/kmille2/deezer-downloader). Login into your free Deezer account and grab the `arl` cookie. Then:

mkdir downloads sudo docker run -p 5000:5000 --volume $(pwd)/downloads/:/mnt/deezer-downloader --env DEEZER\_COOKIE\_ARL=changeme kmille2/deezer-downloader:latest xdg-open [http://localhost:5000](http://localhost:5000)

If you want to debug or build it from source: there is a docker-compose file in the docker directory. The `docker/downloads` directory is mounted into the container and will be used as download directory. You have to check the permissions of the `docker/downloads` directory as docker mounts it with the same owner/group/permissions as on the host. The `deezer` user in the docker container has uid 1000. If you also have the uid 1000 then there should be no problem. For debugging: `sudo docker-compose build --force-rm && sudo docker-compose up`

### Manual deployment

apt-get update -q apt-get install -qy vim tmux git gcc ffmpeg apt-get install -qy python3-virtualenv python3-dev git clone [https://github.com/kmille/deezer-downloader.git](https://github.com/kmille/deezer-downloader.git) /opt/deezer python3 -m virtualenv -p python3 /opt/deezer/app/venv source /opt/deezer/app/venv/bin/activate pip install -r /opt/deezer/requirements.txt pip install -U yt-dlp cp /opt/deezer/app/settings.ini.example /opt/deezer/app/settings.ini # Adjust /opt/deezer/app/settings.ini /opt/deezer/app/venv/bin/python /opt/deezer/app/app.py # for mpd apt-get install -yq mpd ncmpcpp # adjust the file paths in /etc/mpd.conf and settings.ini systemctl restart mpd ncmpcpp -h 127.0.0.1

### Shortcuts

ctrl-m: focus search bar  
Enter: serach for songs  
Alt+Enter: search for albums  
ctrl-b: go to / (this is where our ympd is)  
ctrl-shift-[1-7] switch tabs

### Some screenshots

Search for songs. You can listen to a 30 second preview in the browser.

[![](https://github.com/kmille/deezer-downloader/raw/master/screenshots/2020-05-13-211356_screenshot.png)](https://github.com/kmille/deezer-downloader/blob/master/screenshots/2020-05-13-211356_screenshot.png)

Search for albums. You can download them as zip file.

[![](https://github.com/kmille/deezer-downloader/raw/master/screenshots/2020-05-13-213544_screenshot.png)](https://github.com/kmille/deezer-downloader/blob/master/screenshots/2020-05-13-213544_screenshot.png)

List songs of an album.

[![](https://github.com/kmille/deezer-downloader/raw/master/screenshots/2020-05-13-211528_screenshot.png)](https://github.com/kmille/deezer-downloader/blob/master/screenshots/2020-05-13-211528_screenshot.png)

Download songs with youtube-dl

[![](https://github.com/kmille/deezer-downloader/raw/master/screenshots/2020-05-13-211622_screenshot.png)](https://github.com/kmille/deezer-downloader/blob/master/screenshots/2020-05-13-211622_screenshot.png)

Download a Spotify playlist.

[![](https://github.com/kmille/deezer-downloader/raw/master/screenshots/2020-05-13-211629_screenshot.png)](https://github.com/kmille/deezer-downloader/blob/master/screenshots/2020-05-13-211629_screenshot.png)

Download a Deezer playlist.

[![](https://github.com/kmille/deezer-downloader/raw/master/screenshots/2020-05-13-211633_screenshot.png)](https://github.com/kmille/deezer-downloader/blob/master/screenshots/2020-05-13-211633_screenshot.png)

ncmpcpp mpd client.

[![](https://github.com/kmille/deezer-downloader/raw/master/screenshots/2020-05-13-212025_screenshot.png)](https://github.com/kmille/deezer-downloader/blob/master/screenshots/2020-05-13-212025_screenshot.png)

### Tests

cd app source venv/bin/activate python -m pytest -v tests.py

### Deployment with Ansible (including mpd and ympd)

[https://github.com/kmille/music-ansible](https://github.com/kmille/music-ansible) (almost always outdated)

### Changelog

#### Version 1.3.3 (27.12.2021)

- replace youtube-dl by yt-dl
- update third party dependencies

#### Version 1.3.2 (26.11.2021)

- fix broken deezer download functionality ([#66](https://github.com/kmille/deezer-downloader/issues/66), removes the ability to download flac quality)
- update third party dependencies
- update ubuntu base image for the docker container

#### Version 1.3.1 (21.01.2021)

- allow to set download quality (flac|mp3) via environment variable DEEZER\_FLAC\_QUALITY ([#43](https://github.com/kmille/deezer-downloader/issues/43))

#### Version 1.3 (05.11.2020)

- feature: download your favorite Deezer songs
- automated tests with Github Actions
- push Docker image to [hub.docker.com](https://hub.docker.com/repository/docker/kmille2/deezer-downloader/general) with Github Actions

#### Version 1.2 (01.11.2020)

- **breaking change:** now use the `arl` cookie instead of the `sid` cookie. This cookie does not expire so we don’t need the background thread that keeps the session alive
- add support for flac as download format

#### Version 1.1 (13.05.2020)

- thanks to [luelista](https://github.com/luelista) for the contribution!
- play 30 second preview in browser
- add Vagrantfile
- show album cover in search results
- use a threaded queue for download tasks
- list album songs

## GitHub:

> **[GitHub - kmille/deezer-downloader: Download music from Deezer with a nice front end](https://github.com/kmille/deezer-downloader)**
>
> Download music from Deezer with a nice front end
