## Music Downloader 🎶 🎧 💃 🦄
[![tests](https://github.com/kmille/deezer-downloader/actions/workflows/tests.yaml/badge.svg)](https://github.com/kmille/deezer-downloader/actions/workflows/tests.yaml)
![latest tag](https://img.shields.io/github/v/tag/kmille/deezer-downloader?sort=semver) ![Python 3.6](https://img.shields.io/badge/python-%3E=3.6-blue.svg) ![pypi-version](https://img.shields.io/pypi/v/deezer-downloader) ![pypi-downloads](https://img.shields.io/pypi/dm/deezer-downloader)
### Features
- download songs, albums, public playlists from 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~~ (currently only 128 kbit/s, see [this issue](https://github.com/kmille/deezer-downloader/issues/66#issuecomment-2002309521)) mp3s with ID3-Tags and album cover
- download songs via yt-dlp
- KISS (keep it simple and stupid) front end
- MPD integration (use it on a Raspberry Pi!)
- simple REST api
- proxy support (https/socks5)
### 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. **Important: The ARL cookie must be of a non-premium account!**
```bash
kmille@linbox:deezer-downloader poetry run deezer-downloader --help
usage: deezer-downloader [-h] [-v] [-t] [-c CONFIG]
Download music from Deezer with a nice front end
options:
-h, --help show this help message and exit
-v, --version show version and exit
-t, --show-config-template
show config template. At least you have to insert the ARL cookie
-c CONFIG, --config CONFIG
config file - if not supplied, the following directories are considered looking for deezer-downloader.ini: current working directory, XDG_CONFIG_HOME environment variable, ~/.config, /etc)
kmille@linbox:deezer-downloader
kmille@linbox:deezer-downloader poetry run deezer-downloader --config settings.ini
Starting Threadpool
/home/kmille/.cache/pypoetry/virtualenvs/deezer-downloader-NFDPq16k-py3.11/lib/python3.11/site-packages/giphypop.py:241: UserWarning: You are using the giphy public api key. This should be used for testing only and may be deactivated in the future. See https://github.com/Giphy/GiphyAPI.
warnings.warn('You are using the giphy public api key. This '
Worker 0 is waiting for a task
Worker 1 is waiting for a task
Worker 2 is waiting for a task
Worker 3 is waiting for a task
Worker 0 is now working on task: {'track_id': 8086130, 'add_to_playlist': False}
Downloading 'Adele - Set Fire to the Rain.mp3'
Dowload finished: /tmp/deezer-downloader/songs/Adele - Set Fire to the Rain.mp3
Setting state to mission accomplished to worker 0
worker 0 is done with task: {'track_id': 8086130, 'add_to_playlist': False} (state=mission accomplished)
```
### How to get it up and running
#### with pip
You can run `pip install --user deezer-downloader`. Then you can run `~/.local/bin/deezer-downloader --help`
#### with 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:
```bash
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
```
#### with Vagrant
```bash
vagrant up
vagrant ssh
sudo vim /opt/deezer/settings.ini # insert your Deezer cookie
cd /opt/deezer && sudo poetry run deezer-downloader --config settings.ini
# On the host:
xdg-open http://localhost:5000 # view frontend in the browser
ncmpcpp -h 127.0.0.1 # try the mpd client
```
#### 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.Shortcuts
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`
#### developer setup (tested on Ubuntu Jammy)
```bash
sudo apt-get update -q
sudo apt-get install -qy vim tmux git ffmpeg
# python3-poetry is too old (does not support groups ...)
sudo apt-get install -qy python3-pip
sudo pip install poetry
git clone https://github.com/kmille/deezer-downloader.git
cd deezer-downloader
poetry install
poetry run deezer-downloader --show-config-template > settings.ini
# enable yt-dlp
sudo pip install yt-dlp
sed -i 's,.*command = /usr/bin/yt-dlp.*,command = /usr/local/bin/yt-dlp,' settings.ini
# enable mpd
sudo apt-get install -yq mpd ncmpcpp
sudo sed -i 's,^music_directory.*,music_directory "/tmp/deezer-downloader",' /etc/mpd.conf
sudo systemctl restart mpd
sed -i 's/.*use_mpd = False.*/use_mpd = True/' settings.ini
# 1) Adjust the Deezer cookie: vim settings.ini
# 2) Run tests: DEEZER_DOWNLOADER_CONFIG_FILE=settings.ini poetry run pytest -v -s
# 3) Run it: poetry run deezer-downloader --config settings.ini
# 4) Try out: ncmpcpp -h 127.0.0.1 && xdg-open http://localhost:5000
# 5) Downloaded files are in /tmp/deezer-downloader
```
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.
![](/docs/screenshots/2020-05-13-211356_screenshot.png)
Search for albums. You can download them as zip file.
![](/docs/screenshots/2020-05-13-213544_screenshot.png)
List songs of an album.
![](/docs/screenshots/2020-05-13-211528_screenshot.png)
Download songs with youtube-dl
![](/docs/screenshots/2020-05-13-211622_screenshot.png)
Download a Spotify playlist.
![](/docs/screenshots/2020-05-13-211629_screenshot.png)
Download a Deezer playlist.
![](/docs/screenshots/2020-05-13-211633_screenshot.png)
ncmpcpp mpd client.
![](/docs/screenshots/2020-05-13-212025_screenshot.png)
### Tests
```bash
cd deezer-downloader
DEEZER_DOWNLOADER_CONFIG_FILE=settings.ini poetry run pytest -v -s
# if you don't setDEEZER_DOWNLOADER_CONFIG_FILE the default template file will be used. Some tests will fail because there is no valid arl_cookie.
```
### Deployment with Ansible (including mpd and ympd)
https://github.com/kmille/music-ansible (almost always outdated)
### Changelog
#### Version 2.0.0 (27.03.2023)
- use poetry as build system
- build package and uploada to pypi
- worker threads now "daemon threads" (they now just stop if you stop deezer-downloader)
- update config template (remove http.debug)
- update dependencies
- switch to waitress (from gunicorn)
#### 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, 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)
#### 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
Raw data
{
"_id": null,
"home_page": "https://github.com/kmille/deezer-downloader",
"name": "deezer-downloader",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.8.1",
"maintainer_email": null,
"keywords": null,
"author": "kmille",
"author_email": "github@androidloves.me",
"download_url": "https://files.pythonhosted.org/packages/48/d3/b638c78774ed778bb1893df78b379c20fcedeb280027bff9fee0385676ee/deezer_downloader-2.0.8.tar.gz",
"platform": null,
"description": "## Music Downloader \ud83c\udfb6 \ud83c\udfa7 \ud83d\udc83 \ud83e\udd84\n[![tests](https://github.com/kmille/deezer-downloader/actions/workflows/tests.yaml/badge.svg)](https://github.com/kmille/deezer-downloader/actions/workflows/tests.yaml)\n![latest tag](https://img.shields.io/github/v/tag/kmille/deezer-downloader?sort=semver) ![Python 3.6](https://img.shields.io/badge/python-%3E=3.6-blue.svg) ![pypi-version](https://img.shields.io/pypi/v/deezer-downloader) ![pypi-downloads](https://img.shields.io/pypi/dm/deezer-downloader)\n\n### Features\n\n- download songs, albums, public playlists from Deezer.com (account is required, free plan is enough)\n- download Spotify playlists (by parsing the Spotify website and download the songs from Deezer)\n- download as zip file (including m3u8 playlist file)\n- ~~320 kbit/s~~ (currently only 128 kbit/s, see [this issue](https://github.com/kmille/deezer-downloader/issues/66#issuecomment-2002309521)) mp3s with ID3-Tags and album cover\n- download songs via yt-dlp\n- KISS (keep it simple and stupid) front end\n- MPD integration (use it on a Raspberry Pi!)\n- simple REST api\n- proxy support (https/socks5)\n\n\n### How to use it\n\nThere 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`. \n\nAs 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. **Important: The ARL cookie must be of a non-premium account!**\n\n```bash\nkmille@linbox:deezer-downloader poetry run deezer-downloader --help\nusage: deezer-downloader [-h] [-v] [-t] [-c CONFIG]\n\nDownload music from Deezer with a nice front end\n\noptions:\n -h, --help show this help message and exit\n -v, --version show version and exit\n -t, --show-config-template\n show config template. At least you have to insert the ARL cookie\n -c CONFIG, --config CONFIG\n config file - if not supplied, the following directories are considered looking for deezer-downloader.ini: current working directory, XDG_CONFIG_HOME environment variable, ~/.config, /etc)\nkmille@linbox:deezer-downloader\n\nkmille@linbox:deezer-downloader poetry run deezer-downloader --config settings.ini\nStarting Threadpool\n/home/kmille/.cache/pypoetry/virtualenvs/deezer-downloader-NFDPq16k-py3.11/lib/python3.11/site-packages/giphypop.py:241: UserWarning: You are using the giphy public api key. This should be used for testing only and may be deactivated in the future. See https://github.com/Giphy/GiphyAPI.\n warnings.warn('You are using the giphy public api key. This '\nWorker 0 is waiting for a task\nWorker 1 is waiting for a task\nWorker 2 is waiting for a task\nWorker 3 is waiting for a task\nWorker 0 is now working on task: {'track_id': 8086130, 'add_to_playlist': False}\nDownloading 'Adele - Set Fire to the Rain.mp3'\nDowload finished: /tmp/deezer-downloader/songs/Adele - Set Fire to the Rain.mp3\nSetting state to mission accomplished to worker 0\nworker 0 is done with task: {'track_id': 8086130, 'add_to_playlist': False} (state=mission accomplished)\n```\n\n\n### How to get it up and running\n#### with pip\nYou can run `pip install --user deezer-downloader`. Then you can run `~/.local/bin/deezer-downloader --help`\n\n#### with Docker\nYou 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:\n\n```bash\nmkdir downloads\nsudo docker run -p 5000:5000 --volume $(pwd)/downloads/:/mnt/deezer-downloader --env DEEZER_COOKIE_ARL=changeme kmille2/deezer-downloader:latest \nxdg-open http://localhost:5000\n```\n\n#### with Vagrant\n\n```bash\t\nvagrant up\nvagrant ssh\nsudo vim /opt/deezer/settings.ini # insert your Deezer cookie\ncd /opt/deezer && sudo poetry run deezer-downloader --config settings.ini\n\n# On the host:\nxdg-open http://localhost:5000 # view frontend in the browser\nncmpcpp -h 127.0.0.1 # try the mpd client\n```\n\n#### as a service\n\nWe use it with nginx and [ympd](https://github.com/notandy/ympd) as mpd frontend\n\n- / goes to ympd\n- /d/ goes to the downloader\n\nThe 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.Shortcuts\n\n\n\nIf 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`\n\n#### developer setup (tested on Ubuntu Jammy)\n\n```bash\n sudo apt-get update -q\n sudo apt-get install -qy vim tmux git ffmpeg\n\n # python3-poetry is too old (does not support groups ...)\n sudo apt-get install -qy python3-pip\n sudo pip install poetry\n git clone https://github.com/kmille/deezer-downloader.git\n cd deezer-downloader\n poetry install\n poetry run deezer-downloader --show-config-template > settings.ini\n\n # enable yt-dlp\n sudo pip install yt-dlp\n sed -i 's,.*command = /usr/bin/yt-dlp.*,command = /usr/local/bin/yt-dlp,' settings.ini\n\n # enable mpd\n sudo apt-get install -yq mpd ncmpcpp\n sudo sed -i 's,^music_directory.*,music_directory \"/tmp/deezer-downloader\",' /etc/mpd.conf\n sudo systemctl restart mpd\n sed -i 's/.*use_mpd = False.*/use_mpd = True/' settings.ini\n\n # 1) Adjust the Deezer cookie: vim settings.ini\n # 2) Run tests: DEEZER_DOWNLOADER_CONFIG_FILE=settings.ini poetry run pytest -v -s\n # 3) Run it: poetry run deezer-downloader --config settings.ini\n # 4) Try out: ncmpcpp -h 127.0.0.1 && xdg-open http://localhost:5000\n # 5) Downloaded files are in /tmp/deezer-downloader\n```\n\nctrl-m: focus search bar \nEnter: serach for songs \nAlt+Enter: search for albums \nctrl-b: go to / (this is where our ympd is) \nctrl-shift-[1-7] switch tabs \n\n### Some screenshots\n\nSearch for songs. You can listen to a 30 second preview in the browser. \n\n![](/docs/screenshots/2020-05-13-211356_screenshot.png) \n\nSearch for albums. You can download them as zip file. \n\n![](/docs/screenshots/2020-05-13-213544_screenshot.png)\n\nList songs of an album.\n\n![](/docs/screenshots/2020-05-13-211528_screenshot.png)\n\nDownload songs with youtube-dl \n\n![](/docs/screenshots/2020-05-13-211622_screenshot.png)\n\nDownload a Spotify playlist. \n\n![](/docs/screenshots/2020-05-13-211629_screenshot.png) \n\nDownload a Deezer playlist. \n\n![](/docs/screenshots/2020-05-13-211633_screenshot.png) \n\nncmpcpp mpd client. \n\n![](/docs/screenshots/2020-05-13-212025_screenshot.png) \n\n### Tests\n\n```bash\ncd deezer-downloader\nDEEZER_DOWNLOADER_CONFIG_FILE=settings.ini poetry run pytest -v -s\n# if you don't setDEEZER_DOWNLOADER_CONFIG_FILE the default template file will be used. Some tests will fail because there is no valid arl_cookie.\n```\n\n### Deployment with Ansible (including mpd and ympd)\nhttps://github.com/kmille/music-ansible (almost always outdated)\n\n\n\n### Changelog\n\n#### Version 2.0.0 (27.03.2023)\n- use poetry as build system\n- build package and uploada to pypi\n- worker threads now \"daemon threads\" (they now just stop if you stop deezer-downloader)\n- update config template (remove http.debug)\n- update dependencies\n- switch to waitress (from gunicorn)\n\n#### Version 1.3.3 (27.12.2021)\n- replace youtube-dl by yt-dl\n- update third party dependencies\n\n#### Version 1.3.2 (26.11.2021)\n- fix broken deezer download functionality (#66, removes the ability to download flac quality)\n- update third party dependencies\n- update ubuntu base image for the docker container\n\n#### Version 1.3.1 (21.01.2021)\n- allow to set download quality (flac|mp3) via environment variable DEEZER_FLAC_QUALITY (#43)\n\n#### Version 1.3 (05.11.2020)\n\n- feature: download your favorite Deezer songs\n- automated tests with Github Actions\n- push Docker image to [hub.docker.com](https://hub.docker.com/repository/docker/kmille2/deezer-downloader/general) with Github Actions\n\n#### Version 1.2 (01.11.2020)\n\n- **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\n- add support for flac as download format\n\n#### Version 1.1 (13.05.2020)\n\n- thanks to [luelista](https://github.com/luelista) for the contribution!\n- play 30 second preview in browser\n- add Vagrantfile\n- show album cover in search results\n- use a threaded queue for download tasks\n- list album songs\n",
"bugtrack_url": null,
"license": null,
"summary": "download music from Deezer with a nice front end",
"version": "2.0.8",
"project_urls": {
"Homepage": "https://github.com/kmille/deezer-downloader",
"Repository": "https://github.com/kmille/deezer-downloader"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a03dcbe062f6a01d9bae574ead28c59ec7ba16bfb0173a3e574cc7b2253bd554",
"md5": "01ddcacec379c31c57b8e6d975743aee",
"sha256": "925b18738b7b6d3188ffa0a111ebf1c046c0c3c7d1af073cb8dd544473030e34"
},
"downloads": -1,
"filename": "deezer_downloader-2.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "01ddcacec379c31c57b8e6d975743aee",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.8.1",
"size": 837108,
"upload_time": "2024-04-15T10:54:39",
"upload_time_iso_8601": "2024-04-15T10:54:39.094411Z",
"url": "https://files.pythonhosted.org/packages/a0/3d/cbe062f6a01d9bae574ead28c59ec7ba16bfb0173a3e574cc7b2253bd554/deezer_downloader-2.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "48d3b638c78774ed778bb1893df78b379c20fcedeb280027bff9fee0385676ee",
"md5": "55b4e820cd140e1434189bbd357b0e81",
"sha256": "62d8144fdd0f8ed170dd414265a399fb0c3e753115806f38967f7edc8c417a20"
},
"downloads": -1,
"filename": "deezer_downloader-2.0.8.tar.gz",
"has_sig": false,
"md5_digest": "55b4e820cd140e1434189bbd357b0e81",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.8.1",
"size": 837107,
"upload_time": "2024-04-15T10:54:43",
"upload_time_iso_8601": "2024-04-15T10:54:43.801243Z",
"url": "https://files.pythonhosted.org/packages/48/d3/b638c78774ed778bb1893df78b379c20fcedeb280027bff9fee0385676ee/deezer_downloader-2.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-15 10:54:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "kmille",
"github_project": "deezer-downloader",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "deezer-downloader"
}