Skip to main content

Download Spotify songs to mp3 with full metadata and cover art!

Project description

Savify PyPi Build Documentation Status Release Downloads Discord Stars Contributors Updates

Savify

Savify is a python library that downloads songs from a selected provider (by default YouTube), and then scrapes the meta information from Spotify. Given a query, Savify will find and download songs to mp3 format with quality as high as 320 kb/s! The application will also scrape and write id3v2 tags to all your songs. Tags include title, artists, year, album and even cover-art!

Savify supports all Spotify track, album, and playlist links. Additionally, there is an integrated search function so even if you do not have the Spotify link you can simply enter song name and Savify will download it!

As well as mp3, Savify can also download and convert to other file types. Inside the application, you can specify which format and quality you would like to download the song in for maximum compatibility across all your devices. Available formats: mp3, aac, flac, m4a, opus, vorbis, and wav. Tags and cover art will only be applied to songs downloaded in mp3 format.

Please note this library does not go against Spotify TOS in any way, songs are not ripped directly from Spotify, but are instead downloaded from other sources such as YouTube and Soundcloud using the youtube-dl python library. Spotify is only used to gather accurate meta information to be embedded into the downloaded song files.

Any questions or feedback join the Discord Server

Donate

FFmpeg

Savify relies on the open source FFmpeg library to convert and write metadata to the songs it downloads. Please make sure FFmpeg is installed on your computer and added to the System PATH. Follow the tutorial here.

Playlists

If you want to use Savify to download personal Spotify playlists, ensure their visibility is set to ‘Public’. This is so Savify can use the Spotify API to retrieve the song details from your playlist.

Installation

If you are on Windows you can download the latest pre-packed executable package (which I recommend as you will not have to provide a Savify API key), or you can download the python library and run the module directly using the CLI.

Download the latest release

Go here to download the latest Savify.exe then make sure you have:

  • FFmpeg downloaded and it added to your Path

  • Spotify API credentials added to your environment variables

That is it, you should be good to go! See some usage examples below.

Using the Python module

$ pip install -U savify

Usage

Currently Savify only supports Spotify URLs and search queries, however support for Spotify URIs will be added in the future.

CLI

If you have downloaded the latest Savify.exe from the releases page open your terminal and navigate to the same directory as the binary, then you can run:

$ Savify.exe

If you are using the Python package and savify is installed to your site-packages and your pip folder is in your PATH (which it should be by default), from anywhere you can simply run:

$ savify

For help run:

$ savify --help

General usage

Using the default above:

$ savify "https://open.spotify.com/track/4Dju9g4NCz0LDxwcjonSvI"

Specifying your own options:

$ savify "https://open.spotify.com/track/4Dju9g4NCz0LDxwcjonSvI" -q best -f mp3 -o "/path/to/downloads" -g "%artist%/%album%"

With a search query:

$ savify "You & I - Bru-C" -t track -q best -f mp3 -o "/path/to/downloads" -g "%artist%/%album%"

Grouping

Available variables: %artist%, %album%, %playlist%

For example:

$ savify "You & I - Bru-C" -o /path/to/downloads -g "%artist%/%album%"

Would download in the following directory structure:

/path/to/downloads
     |
     |- /Bru-C
          |
          |- /Original Sounds
               |
               |- Bru-C - You & I.mp3

Download Defaults

Query Type:

track

Quality:

best

Format:

mp3

Path:

Windows: HOME/AppData/Roaming/Savify/downloads

Linux: HOME/.local/share/Savify/downloads

MacOS: HOME/Library/Application Support/Savify/downloads

Grouping:

no grouping

For more usage examples read the docs.

Spotify Application

To use the Savify Python module you will need your own Spotify developer application to access their API. To do this sign up here. When you have made a new application take note of your client id and secret. You can pass the id and secret to Savify in two ways:

During object instantiation

You can pass in your id and secret using a tuple when creating your Savify object:

s = Savify(api_credentials=("CLIENT_ID","CLIENT_SECRET"))

Use in your Python project

Install the package to your environment:

$ pip install savify

Import and use Savify:

from savify import Savify
from savify.types import Type, Format, Quality

s = Savify()
# Spotify URL
s.download("SPOTIFY URL")

# Search Query
# Types: TRACK, ALBUM, PLAYLIST
s.download("QUERY", query_type=Type.TRACK)

Savify optional constructor arguments (see above for defaults):

import logging

 from savify import Savify
 from savify.types import Type, Format, Quality
 from savify.utils import PathHolder

 # Quality Options: WORST, Q32K, Q96K, Q128K, Q192K, Q256K, Q320K, BEST
 # Format Options: MP3, AAC, FLAC, M4A, OPUS, VORBIS, WAV
 Savify(api_credentials=None, quality=Quality.BEST, download_format=Format.MP3, path_holder=PathHolder(downloads_path='path/for/downloads'), group='%artist%/%album%', quiet=False, skip_cover_art=False, log_level=logging.INFO)

Manually customising youtube-dl options:

from savify import Savify

options = {
    'cookiefile': 'cookies.txt'
}

Savify(ydl_options=options)

Passing in your own logger:

from savify import Savify
from savify.logger import Logger

logger = Logger(log_location='path/for/logs', log_level=None) # Silent output

Savify(logger=logger)

The group argument is used to sort you downloaded songs inside the output path. Possible variables for the path string are: %artist%, %album%, and %playlist%. The variables are replaced with the songs metadata. For example, a song downloaded with the above Savify object would save to a path like this: path/for/downloads/Example Artist/Example Album/Example Song.mp3

For Developers

If you want to try your hand at adding to Savify use the instructions here. From there you can make any additions you think would make Savify better.

Tip

If you are developing Savify, install the pip package locally so you can make and test your changes. From the root directory run:

$ pip install -e .

You can then run the Python module:

$ savify

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

savify-2.3.4.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

savify-2.3.4-py2.py3-none-any.whl (17.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file savify-2.3.4.tar.gz.

File metadata

  • Download URL: savify-2.3.4.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for savify-2.3.4.tar.gz
Algorithm Hash digest
SHA256 777c2eecaf2a035c86be5a5fbf96ecf6b9909e711eeb5fe497f7125d9b9fb28d
MD5 7211b91fe22daf914ee3bc8aabb7b914
BLAKE2b-256 9bb6b20724b3d81ad7d6f806032a2f1380f7b21938884ada26b300653ec86cf5

See more details on using hashes here.

File details

Details for the file savify-2.3.4-py2.py3-none-any.whl.

File metadata

  • Download URL: savify-2.3.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for savify-2.3.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 573804d1cda381b35bb27a06c9df65d52a43dbc6d0b5c863f8299323f35db49f
MD5 8ddb85ddfdd5012a3918beb6d6d2e61e
BLAKE2b-256 f182b7000c542f2515c426f4025a327f8373e8c9ea4824fdbbd9c1cea12fc946

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page