spotify-web-downloader


Namespotify-web-downloader JSON
Version 1.8 PyPI version JSON
download
home_pageNone
SummaryA Python CLI app for downloading songs and music videos directly from Spotify.
upload_time2024-09-12 14:03:12
maintainerNone
docs_urlNone
authorglomatico
requires_python>=3.8
licenseNone
keywords
VCS
bugtrack_url
requirements click pybase62 pywidevine pyyaml yt-dlp
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Spotify Web Downloader
A Python CLI app for downloading songs and music videos directly from Spotify.

**Discord Server:** https://discord.gg/aBjMEZ9tnq

## Features
* Download songs in AAC 128kbps or in AAC 256kbps with a premium account
* Download synced lyrics
* Download music videos with a premium account
* Highly configurable

## Prerequisites
* Python 3.8 or higher
* A .wvd file
    * A .wvd file contains the Widevine keys from a device. The easiest method of obtaining one is using KeyDive, which extracts it from an Android device. Detailed instructions can be found here: https://github.com/hyugogirubato/KeyDive.
* The cookies file of your Spotify browser session in Netscape format (free or premium)
    * You can get your cookies by using one of the following extensions on your browser of choice at the Spotify website with your account signed in:
        * Firefox: https://addons.mozilla.org/addon/export-cookies-txt
        * Chromium based browsers: https://chrome.google.com/webstore/detail/gdocmgbfkjnnpapoeobnolbbkoibbcif
* FFmpeg on your system PATH
    * Older versions of FFmpeg may not work.
    * Up to date binaries can be obtained from the links below:
        * Windows: https://github.com/AnimMouse/ffmpeg-stable-autobuild/releases
        * Linux: https://johnvansickle.com/ffmpeg/

## Installation
1. Install the package `spotify-web-downloader` using pip
    ```bash
    pip install spotify-web-downloader
    ```
2. Place your cookies file and the .wvd file in the directory from which you will be running spotify-web-downloader and name it `cookies.txt` and `device.wvd` respectively.

## Usage
```bash
spotify-web-downloader [OPTIONS] URLS...
```

### Examples
* Download a song
    ```bash
    spotify-web-downloader "https://open.spotify.com/track/18gqCQzqYb0zvurQPlRkpo"
    ```
* Download an album
    ```bash
    spotify-web-downloader "https://open.spotify.com/album/0r8D5N674HbTXlR3zNxeU1"
    ```

## Configuration
spotify-web-downloader can be configured using the command line arguments or the config file.

The config file is created automatically when you run spotify-web-downloader for the first time at `~/.spotify-web-downloader/config.json` on Linux and `%USERPROFILE%\.spotify-web-downloader\config.json` on Windows.

Config file values can be overridden using command line arguments.
| Command line argument / Config file key                         | Description                                                                  | Default value                                  |
| --------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------- |
| `--wait-interval`, `-w` / `wait_interval`                       | Wait interval between downloads in seconds.                                  | `10`                                           |
| `--download-music-video` / `download_music_video`               | Attempt to download music videos from songs (can lead to incorrect results). | `false`                                        |
| `--force-premium`, `-f` / `force_premium`                       | Force to detect the account as premium.                                      | `false`                                        |
| `--save-cover`, `-s` / `save_cover`                             | Save cover as a separate file.                                               | `false`                                        |
| `--overwrite` / `overwrite`                                     | Overwrite existing files.                                                    | `false`                                        |
| `--read-urls-as-txt`, `-r` / -                                  | Interpret URLs as paths to text files containing URLs.                       | `false`                                        |
| `--save-playlist` / `save_playlist`                             | Save a M3U8 playlist file when downloading a playlist.                       | `false`                                        |
| `--lrc-only`, `-l` / `lrc_only`                                 | Download only the synced lyrics.                                             | `false`                                        |
| `--no-lrc` / `no_lrc`                                           | Don't download the synced lyrics.                                            | `false`                                        |
| `--config-path` / -                                             | Path to config file.                                                         | `<home>/.spotify-web-downloader/config.json`   |
| `--log-level` / `log_level`                                     | Log level.                                                                   | `INFO`                                         |
| `--print-exceptions` / `print_exceptions`                       | Print exceptions.                                                            | `false`                                        |
| `--cookies-path`, `-c` / `cookies_path`                         | Path to .txt cookies file.                                                   | `./cookies.txt`                                |
| `--output-path`, `-o` / `output_path`                           | Path to output directory.                                                    | `./Spotify`                                    |
| `--temp-path` / `temp_path`                                     | Path to temporary directory.                                                 | `./temp`                                       |
| `--wvd-path` / `wvd_path`                                       | Path to .wvd file.                                                           | `./device.wvd`                                 |
| `--ffmpeg-path` / `ffmpeg_path`                                 | Path to FFmpeg binary.                                                       | `ffmpeg`                                       |
| `--mp4box-path` / `mp4box_path`                                 | Path to MP4Box binary.                                                       | `MP4Box`                                       |
| `--mp4decrypt-path` / `mp4decrypt_path`                         | Path to mp4decrypt binary.                                                   | `mp4decrypt`                                   |
| `--aria2c-path` / `aria2c_path`                                 | Path to aria2c binary.                                                       | `aria2c`                                       |
| `--nm3u8dlre-path` / `nm3u8dlre_path`                           | Path to N_m3u8DL-RE binary.                                                  | `N_m3u8DL-RE`                                  |
| `--remux-mode` / `remux_mode`                                   | Remux mode.                                                                  | `ffmpeg`                                       |
| `--template-folder-album` / `template_folder_album`             | Template folder for tracks that are part of an album.                        | `{album_artist}/{album}`                       |
| `--template-folder-compilation` / `template_folder_compilation` | Template folder for tracks that are part of a compilation album.             | `Compilations/{album}`                         |
| `--template-file-single-disc` / `template_file_single_disc`     | Template file for the tracks that are part of a single-disc album.           | `{track:02d} {title}`                          |
| `--template-file-multi-disc` / `template_file_multi_disc`       | Template file for the tracks that are part of a multi-disc album.            | `{disc}-{track:02d} {title}`                   |
| `--template-folder-no-album` / `template_folder_no_album`       | Template folder for the tracks that are not part of an album.                | `{artist}/Unknown Album`                       |
| `--template-file-no-album` / `template_file_no_album`           | Template file for the tracks that are not part of an album.                  | `{title}`                                      |
| `--template-file-playlist` / `template_file_playlist`           | Template file for the M3U8 playlist.                                         | `Playlists/{playlist_artist}/{playlist_title}` |
| `--date-tag-template` / `date_tag_template`                     | Date tag template.                                                           | `%Y-%m-%dT%H:%M:%SZ`                           |
| `--exclude-tags` / `exclude_tags`                               | Comma-separated tags to exclude.                                             | `null`                                         |
| `--truncate` / `truncate`                                       | Maximum length of the file/folder names.                                     | `null`                                         |
| `--download-mode-song` / `download_mode_song`                   | Download mode for songs.                                                     | `ytdlp`                                        |
| `--premium-quality`, `-p` / `premium_quality`                   | Download songs in premium quality.                                           | `false`                                        |
| `--download-mode-video` / `download_mode_video`                 | Download mode for videos.                                                    | `ytdlp`                                        |
| `--no-config-file`, `-n` / -                                    | Do not use a config file.                                                    | `false`                                        |



### Tag variables
The following variables can be used in the template folder/file and/or in the `exclude_tags` list:
- `album`
- `album_artist`
- `artist`
- `compilation`
- `composer`
- `copyright`
- `cover`
- `disc`
- `disc_total`
- `isrc`
- `label`
- `lyrics`
- `media_type`
- `playlist_artist`
- `playlist_title`
- `playlist_track`
- `producer`
- `rating`
- `release_date`
- `release_year`
- `title`
- `track`
- `track_total`
- `url`
  
### Remux modes
The following remux modes are available:
* `ffmpeg`
* `mp4box`
    * Requires mp4decrypt
    * Can be obtained from here: https://gpac.wp.imt.fr/downloads

### Music videos quality
Music videos will be downloaded in the highest quality available in H.264/AAC, up to 1080p.

### Download modes
The following modes are available for songs:
* `ytdlp`
* `aria2c`
    * Faster than `ytdlp`
    * Can be obtained from here: https://github.com/aria2/aria2/releases

The following modes are available for videos:
* `ytdlp`
* `nm3u8dlre`
    * Faster than `ytdlp`
    * Can be obtained from here: https://github.com/nilaoda/N_m3u8DL-RE/releases

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "spotify-web-downloader",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "glomatico",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/a0/b5/77c0ca95b81695326360ebe9f2410f49e5db41c80ee05803407c126d623b/spotify_web_downloader-1.8.tar.gz",
    "platform": null,
    "description": "# Spotify Web Downloader\nA Python CLI app for downloading songs and music videos directly from Spotify.\n\n**Discord Server:** https://discord.gg/aBjMEZ9tnq\n\n## Features\n* Download songs in AAC 128kbps or in AAC 256kbps with a premium account\n* Download synced lyrics\n* Download music videos with a premium account\n* Highly configurable\n\n## Prerequisites\n* Python 3.8 or higher\n* A .wvd file\n    * A .wvd file contains the Widevine keys from a device. The easiest method of obtaining one is using KeyDive, which extracts it from an Android device. Detailed instructions can be found here: https://github.com/hyugogirubato/KeyDive.\n* The cookies file of your Spotify browser session in Netscape format (free or premium)\n    * You can get your cookies by using one of the following extensions on your browser of choice at the Spotify website with your account signed in:\n        * Firefox: https://addons.mozilla.org/addon/export-cookies-txt\n        * Chromium based browsers: https://chrome.google.com/webstore/detail/gdocmgbfkjnnpapoeobnolbbkoibbcif\n* FFmpeg on your system PATH\n    * Older versions of FFmpeg may not work.\n    * Up to date binaries can be obtained from the links below:\n        * Windows: https://github.com/AnimMouse/ffmpeg-stable-autobuild/releases\n        * Linux: https://johnvansickle.com/ffmpeg/\n\n## Installation\n1. Install the package `spotify-web-downloader` using pip\n    ```bash\n    pip install spotify-web-downloader\n    ```\n2. Place your cookies file and the .wvd file in the directory from which you will be running spotify-web-downloader and name it `cookies.txt` and `device.wvd` respectively.\n\n## Usage\n```bash\nspotify-web-downloader [OPTIONS] URLS...\n```\n\n### Examples\n* Download a song\n    ```bash\n    spotify-web-downloader \"https://open.spotify.com/track/18gqCQzqYb0zvurQPlRkpo\"\n    ```\n* Download an album\n    ```bash\n    spotify-web-downloader \"https://open.spotify.com/album/0r8D5N674HbTXlR3zNxeU1\"\n    ```\n\n## Configuration\nspotify-web-downloader can be configured using the command line arguments or the config file.\n\nThe config file is created automatically when you run spotify-web-downloader for the first time at `~/.spotify-web-downloader/config.json` on Linux and `%USERPROFILE%\\.spotify-web-downloader\\config.json` on Windows.\n\nConfig file values can be overridden using command line arguments.\n| Command line argument / Config file key                         | Description                                                                  | Default value                                  |\n| --------------------------------------------------------------- | ---------------------------------------------------------------------------- | ---------------------------------------------- |\n| `--wait-interval`, `-w` / `wait_interval`                       | Wait interval between downloads in seconds.                                  | `10`                                           |\n| `--download-music-video` / `download_music_video`               | Attempt to download music videos from songs (can lead to incorrect results). | `false`                                        |\n| `--force-premium`, `-f` / `force_premium`                       | Force to detect the account as premium.                                      | `false`                                        |\n| `--save-cover`, `-s` / `save_cover`                             | Save cover as a separate file.                                               | `false`                                        |\n| `--overwrite` / `overwrite`                                     | Overwrite existing files.                                                    | `false`                                        |\n| `--read-urls-as-txt`, `-r` / -                                  | Interpret URLs as paths to text files containing URLs.                       | `false`                                        |\n| `--save-playlist` / `save_playlist`                             | Save a M3U8 playlist file when downloading a playlist.                       | `false`                                        |\n| `--lrc-only`, `-l` / `lrc_only`                                 | Download only the synced lyrics.                                             | `false`                                        |\n| `--no-lrc` / `no_lrc`                                           | Don't download the synced lyrics.                                            | `false`                                        |\n| `--config-path` / -                                             | Path to config file.                                                         | `<home>/.spotify-web-downloader/config.json`   |\n| `--log-level` / `log_level`                                     | Log level.                                                                   | `INFO`                                         |\n| `--print-exceptions` / `print_exceptions`                       | Print exceptions.                                                            | `false`                                        |\n| `--cookies-path`, `-c` / `cookies_path`                         | Path to .txt cookies file.                                                   | `./cookies.txt`                                |\n| `--output-path`, `-o` / `output_path`                           | Path to output directory.                                                    | `./Spotify`                                    |\n| `--temp-path` / `temp_path`                                     | Path to temporary directory.                                                 | `./temp`                                       |\n| `--wvd-path` / `wvd_path`                                       | Path to .wvd file.                                                           | `./device.wvd`                                 |\n| `--ffmpeg-path` / `ffmpeg_path`                                 | Path to FFmpeg binary.                                                       | `ffmpeg`                                       |\n| `--mp4box-path` / `mp4box_path`                                 | Path to MP4Box binary.                                                       | `MP4Box`                                       |\n| `--mp4decrypt-path` / `mp4decrypt_path`                         | Path to mp4decrypt binary.                                                   | `mp4decrypt`                                   |\n| `--aria2c-path` / `aria2c_path`                                 | Path to aria2c binary.                                                       | `aria2c`                                       |\n| `--nm3u8dlre-path` / `nm3u8dlre_path`                           | Path to N_m3u8DL-RE binary.                                                  | `N_m3u8DL-RE`                                  |\n| `--remux-mode` / `remux_mode`                                   | Remux mode.                                                                  | `ffmpeg`                                       |\n| `--template-folder-album` / `template_folder_album`             | Template folder for tracks that are part of an album.                        | `{album_artist}/{album}`                       |\n| `--template-folder-compilation` / `template_folder_compilation` | Template folder for tracks that are part of a compilation album.             | `Compilations/{album}`                         |\n| `--template-file-single-disc` / `template_file_single_disc`     | Template file for the tracks that are part of a single-disc album.           | `{track:02d} {title}`                          |\n| `--template-file-multi-disc` / `template_file_multi_disc`       | Template file for the tracks that are part of a multi-disc album.            | `{disc}-{track:02d} {title}`                   |\n| `--template-folder-no-album` / `template_folder_no_album`       | Template folder for the tracks that are not part of an album.                | `{artist}/Unknown Album`                       |\n| `--template-file-no-album` / `template_file_no_album`           | Template file for the tracks that are not part of an album.                  | `{title}`                                      |\n| `--template-file-playlist` / `template_file_playlist`           | Template file for the M3U8 playlist.                                         | `Playlists/{playlist_artist}/{playlist_title}` |\n| `--date-tag-template` / `date_tag_template`                     | Date tag template.                                                           | `%Y-%m-%dT%H:%M:%SZ`                           |\n| `--exclude-tags` / `exclude_tags`                               | Comma-separated tags to exclude.                                             | `null`                                         |\n| `--truncate` / `truncate`                                       | Maximum length of the file/folder names.                                     | `null`                                         |\n| `--download-mode-song` / `download_mode_song`                   | Download mode for songs.                                                     | `ytdlp`                                        |\n| `--premium-quality`, `-p` / `premium_quality`                   | Download songs in premium quality.                                           | `false`                                        |\n| `--download-mode-video` / `download_mode_video`                 | Download mode for videos.                                                    | `ytdlp`                                        |\n| `--no-config-file`, `-n` / -                                    | Do not use a config file.                                                    | `false`                                        |\n\n\n\n### Tag variables\nThe following variables can be used in the template folder/file and/or in the `exclude_tags` list:\n- `album`\n- `album_artist`\n- `artist`\n- `compilation`\n- `composer`\n- `copyright`\n- `cover`\n- `disc`\n- `disc_total`\n- `isrc`\n- `label`\n- `lyrics`\n- `media_type`\n- `playlist_artist`\n- `playlist_title`\n- `playlist_track`\n- `producer`\n- `rating`\n- `release_date`\n- `release_year`\n- `title`\n- `track`\n- `track_total`\n- `url`\n  \n### Remux modes\nThe following remux modes are available:\n* `ffmpeg`\n* `mp4box`\n    * Requires mp4decrypt\n    * Can be obtained from here: https://gpac.wp.imt.fr/downloads\n\n### Music videos quality\nMusic videos will be downloaded in the highest quality available in H.264/AAC, up to 1080p.\n\n### Download modes\nThe following modes are available for songs:\n* `ytdlp`\n* `aria2c`\n    * Faster than `ytdlp`\n    * Can be obtained from here: https://github.com/aria2/aria2/releases\n\nThe following modes are available for videos:\n* `ytdlp`\n* `nm3u8dlre`\n    * Faster than `ytdlp`\n    * Can be obtained from here: https://github.com/nilaoda/N_m3u8DL-RE/releases\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python CLI app for downloading songs and music videos directly from Spotify.",
    "version": "1.8",
    "project_urls": {
        "repository": "https://github.com/glomatico/spotify-web-downloader"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7b8ab4bec31bb360dbd5458b454757ead270243b665385148f6fee4e5c2919f0",
                "md5": "27344334d495fa67d57b2672ff0f375a",
                "sha256": "de8e09522508184aa8657c231d7fec66b397a91a42aeb262ad601e5f6879e5e3"
            },
            "downloads": -1,
            "filename": "spotify_web_downloader-1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "27344334d495fa67d57b2672ff0f375a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 22452,
            "upload_time": "2024-09-12T14:03:11",
            "upload_time_iso_8601": "2024-09-12T14:03:11.242986Z",
            "url": "https://files.pythonhosted.org/packages/7b/8a/b4bec31bb360dbd5458b454757ead270243b665385148f6fee4e5c2919f0/spotify_web_downloader-1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a0b577c0ca95b81695326360ebe9f2410f49e5db41c80ee05803407c126d623b",
                "md5": "ec57fc28afea1d686619c2ee6ae7c563",
                "sha256": "a6ceb84ea0e7dea0e3886ceb13975e39f709565a7f21261b204def030642636b"
            },
            "downloads": -1,
            "filename": "spotify_web_downloader-1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "ec57fc28afea1d686619c2ee6ae7c563",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 20265,
            "upload_time": "2024-09-12T14:03:12",
            "upload_time_iso_8601": "2024-09-12T14:03:12.623029Z",
            "url": "https://files.pythonhosted.org/packages/a0/b5/77c0ca95b81695326360ebe9f2410f49e5db41c80ee05803407c126d623b/spotify_web_downloader-1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-12 14:03:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "glomatico",
    "github_project": "spotify-web-downloader",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "click",
            "specs": []
        },
        {
            "name": "pybase62",
            "specs": []
        },
        {
            "name": "pywidevine",
            "specs": []
        },
        {
            "name": "pyyaml",
            "specs": []
        },
        {
            "name": "yt-dlp",
            "specs": []
        }
    ],
    "lcname": "spotify-web-downloader"
}
        
Elapsed time: 0.94131s