Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.

Dev #25

Merged
merged 51 commits into from
Apr 2, 2024
Merged

Dev #25

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
699febb
Create spotify_api.py
glomatico Mar 29, 2024
7fc2c6b
Create downloader_song.py
glomatico Mar 29, 2024
0197d69
Create enums.py
glomatico Mar 29, 2024
1e2b0d5
Create models.py
glomatico Mar 29, 2024
1d5dfaf
change default value for cookies_path
glomatico Mar 29, 2024
fcd86bf
move get_tags and get_artist methods to downloader
glomatico Mar 29, 2024
46a4a9b
rename DownloadModeMusicVideo to DownloadModeVideo
glomatico Mar 29, 2024
9dd05f1
add VideoStreamInfo
glomatico Mar 29, 2024
8807807
move no_progress to downloader
glomatico Mar 29, 2024
770a47d
add videom3u8
glomatico Mar 29, 2024
0643dce
fix typo
glomatico Mar 29, 2024
3bcda7d
Update constants.py
glomatico Mar 29, 2024
b314dca
Create downloader_music_video.py
glomatico Mar 29, 2024
495654a
add fflags bitexact
glomatico Mar 29, 2024
04888fb
fix missing annotation
glomatico Mar 29, 2024
8b972aa
adjust m3u8 header
glomatico Mar 29, 2024
d0b38a3
new project structure
glomatico Mar 29, 2024
e4645dc
add from __future__ import annotations
glomatico Mar 29, 2024
89cee3f
Update README.md
glomatico Mar 29, 2024
7eed174
Update cli.py
glomatico Mar 29, 2024
588562a
Update README.md
glomatico Mar 29, 2024
1d9f3f5
Update cli.py
glomatico Mar 29, 2024
fb7fc1f
adjust tags
glomatico Mar 29, 2024
377a3d5
adjust save cover
glomatico Mar 29, 2024
5832b04
adjust get_segment_urls
glomatico Mar 29, 2024
aec43a4
Update cli.py
glomatico Mar 29, 2024
31d0c32
Update cli.py
glomatico Mar 29, 2024
12e6519
bump version
glomatico Mar 29, 2024
2922e0a
Update cli.py
glomatico Mar 30, 2024
f48476b
Update cli.py
glomatico Mar 30, 2024
b74caeb
Update spotify_api.py
glomatico Mar 30, 2024
4e9bb19
Update cli.py
glomatico Mar 30, 2024
50eedd7
Update README.md
glomatico Apr 1, 2024
021a185
Update README.md
glomatico Apr 1, 2024
00442fa
Update README.md
glomatico Apr 1, 2024
a269177
Update downloader_song.py
glomatico Apr 1, 2024
2e035da
remove compilation tag of music videos
glomatico Apr 1, 2024
cc4ab10
Update spotify_api.py
glomatico Apr 1, 2024
73b3728
Add get_now_playing_view
glomatico Apr 2, 2024
b020822
Add get_music_video_from_song_id
glomatico Apr 2, 2024
2a5e9eb
Add download_music_video argument
glomatico Apr 2, 2024
266693e
Update README.md
glomatico Apr 2, 2024
584ba4e
Update README.md
glomatico Apr 2, 2024
6693dda
Update README.md
glomatico Apr 2, 2024
e816a9e
Update README.md
glomatico Apr 2, 2024
fb92a64
change get_music_video_id_from_song_id
glomatico Apr 2, 2024
0bcd9ef
Update cli.py
glomatico Apr 2, 2024
169eaa9
Update cli.py
glomatico Apr 2, 2024
d94b829
Update README.md
glomatico Apr 2, 2024
c8be628
Update README.md
glomatico Apr 2, 2024
0754a71
Update downloader.py
glomatico Apr 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 56 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
# Spotify Web Downloader
A Python script to download songs/albums/playlists directly from Spotify in 256kbps/128kbps AAC.
A Python script to download songs/music videos/albums/playlists directly from Spotify.

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

## Pre-requisites
* The cookies file of your Spotify account (free or premium)
* You can get your cookies by using this Google Chrome extension on Spotify website: https://chrome.google.com/webstore/detail/open-cookiestxt/gdocmgbfkjnnpapoeobnolbbkoibbcif. Make sure to be logged in.
* FFmpeg on your system PATH
* Older versions of FFmpeg may not work.
* Python 3.7 or higher

## Installation
1. Install Python 3.7 or higher
2. Add [FFmpeg](https://ffmpeg.org/download.html) to PATH
* Older versions of FFmpeg may not work
3. Place your cookies in the same folder that you will run spotify-web-downloader as `cookies.txt`
* You can export your cookies by using this Google Chrome extension on Spotify website: https://chrome.google.com/webstore/detail/open-cookiestxt/gdocmgbfkjnnpapoeobnolbbkoibbcif. Make sure to be logged in.
4. Install spotify-web-downloader using pip
1. Install the package `spotify-web-downloader` using pip
```bash
pip install spotify-web-downloader
```
2. Place your cookies in the same directory you will run the script from and name it `cookies.txt`

## Examples
## Usage
* Download a song
```bash
spotify-web-downloader "https://open.spotify.com/track/18gqCQzqYb0zvurQPlRkpo"
Expand All @@ -29,31 +33,37 @@ A Python script to download songs/albums/playlists directly from Spotify in 256k

## 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 |
| --------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------- |
| `-f`, `--final-path` / `final_path` | Path where the downloaded files will be saved. | `./Spotify` |
| `-t`, `--temp-path` / `temp_path` | Path where the temporary files will be saved. | `./temp` |
| `-c`, `--cookies-location` / `cookies_location` | Location of the cookies file. | `./cookies.txt` |
| `-w`, `--wvd-location` / `wvd_location` | Location of the .wvd file. | `null` |
| `--config-location` / - | Location of the config file. | `<home_folder>/.spotify-web-downloader/config.json` |
| `--ffmpeg-location` / `ffmpeg_location` | Location of the FFmpeg binary. | `ffmpeg` |
| `--aria2c-location` / `aria2c_location` | Location of the aria2c binary. | `aria2c` |
| `--template-folder-album` / `template_folder_album` | Template of the album folders as a format string. | `{album_artist}/{album}` |
| `--template-folder-compilation` / `template_folder_compilation` | Template of the compilation album folders as a format string. | `Compilations/{album}` |
| `--template-file-single-disc` / `template_file_single_disc` | Template of the song files for single-disc albums as a format string. | `{track:02d} {title}` |
| `--template-file-multi-disc` / `template_file_multi_disc` | Template of the song files for multi-disc albums as a format string. | `{disc}-{track:02d} {title}` |
| `--download-mode` / `download_mode` | Download mode. | `ytdlp` |
| `-e`, `--exclude-tags` / `exclude_tags` | List of tags to exclude from file tagging separated by commas. | `null` |
| `--truncate` / `truncate` | Maximum length of the file/folder names. | `40` |
| `-l`, `--log-level` / `log_level` | Log level. | `INFO` |
| `-p`, `--premium-quality` / `premium_quality` | Download in 256kbps AAC instead of 128kbps AAC. | `false` |
| `-l`, `--lrc-only` / `lrc_only` | Download only the synced lyrics. | `false` |
| `-n`, `--no-lrc` / `no_lrc` | Don't download the synced lyrics. | `false` |
| `-s`, `--save-cover` / `save_cover` | Save cover as a separate file. | `false` |
| `-o`, `--overwrite` / `overwrite` | Overwrite existing files. | `false` |
| `--print-exceptions` / `print_exceptions` | Print exceptions. | `false` |
| `-u`, `--url-txt` / - | Read URLs as location of text files containing URLs. | `false` |
| `-n`, `--no-config-file` / - | Don't use the config file. | `false` |
| Command line argument / Config file key | Description | Default value |
| --------------------------------------------------------------- | ---------------------------------------------------------------------------- | -------------------------------------------- |
| `--download-music-video` / `download_music_video` | Attempt to download music videos from songs (can lead to incorrect results). | `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` |
| `--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. | `null` |
| `--ffmpeg-path` / `ffmpeg_path` | Path to FFmpeg binary. | `ffmpeg` |
| `--aria2c-path` / `aria2c_path` | Path to aria2c binary. | `aria2c` |
| `--nm3u8dlre-path` / `nm3u8dlre_path` | Path to N_m3u8DL-RE binary. | `N_m3u8DL-RE` |
| `--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. | `40` |
| `--template-folder-album` / `template_folder_album` | Template of the album folders as a format string. | `{album_artist}/{album}` |
| `--template-folder-compilation` / `template_folder_compilation` | Template of the compilation album folders as a format string. | `Compilations/{album}` |
| `--template-file-single-disc` / `template_file_single_disc` | Template of the song files for single-disc albums as a format string. | `{track:02d} {title}` |
| `--template-file-multi-disc` / `template_file_multi_disc` | Template of the song files for multi-disc albums as a format string. | `{disc}-{track:02d} {title}` |
| `--download-mode-song` / `download_mode_song` | Download mode for songs. | `ydlp` |
| `--premium-quality`, `-p` / `premium_quality` | Download songs in premium quality. | `false` |
| `--template-folder-music-video` / `template_folder_music_video` | Template of the music video folders as a format string. | `{artist}/Unknown Album` |
| `--template-file-music-video` / `template_file_music_video` | Template of the music video files as a format string. | `{title}` |
| `--download-mode-video` / `download_mode_video` | Download mode for videos. | `ydlp` |
| `--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:
Expand All @@ -72,13 +82,23 @@ The following variables can be used in the template folder/file and/or in the `e
- `media_type`
- `rating`
- `release_date`
- `release_year`
- `title`
- `track`
- `track_total`

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

### Download mode
The following download modes are available:
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`
* `nm38dlre`
* Faster than `ytdlp`
* Can be obtained from here: https://github.com/nilaoda/N_m3u8DL-RE/releases
2 changes: 1 addition & 1 deletion spotify_web_downloader/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.5.5"
__version__ = "1.6"
Loading