GithubHelp home page GithubHelp logo

funk-y0u / boltz Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 36.77 MB

This is a free and open source spotify songs to mp3 downloader api

Python 100.00%
spotify spotify-api spotify-downloader spotifydownloader python-mp3 spotify-mp3 spotify-mp3-api

boltz's Introduction

Boltz [⚡]

Boltz is a Python-based API simplifying Spotify playlist, album, and track conversion to MP3, allowing users to save music to their preferred location. Developers leverage Boltz to efficiently retrieve Spotify content by providing identifiers, utilizing Spotify's infrastructure for data fetching and MP3 conversion. Users specify the destination directory for flexibility in managing their library. Boltz streamlines Spotify access, empowering developers to innovate with music applications like players, backups, and playlist converters in Python projects.

Index

  1. Install boltz
  2. Use guide
  3. Examples

How to install?

  1. Clone the boltz repository

    $ git clone https://github.com/FuNk-y0u/boltz/
  2. Get into the folder

    $ cd boltz
  3. Install dependencies

    $ pip install -r requirements.txt
  4. Install FFmpeg

    For windows:

    ps choco install ffmpeg

    For linux:

    $ sudo  apt  install ffmpeg

How to use?

  1. Including boltz in your python file
from inc import *
from boltz import *
  1. Creating boltz controller
_boltzController = Boltz(CLIENT_ID, CLIENT_SECRET, "[your download path]")
  1. Initializing url
url = _boltzController.initialize_url("[playlist url here]")
# Assert for error checking
ASSERT(url.is_valid, "Error: Spotify url is not valid")
  1. Fetching tracks from playlist url
tracks = _boltzController.fetch_tracks(url)
# Assert for error checking
ASSERT(tracks, "Error: while fetching tracks")
  1. Looping through tracks obtained from playlist
for track in tracks
  1. Downloading and converting + setting tags to mp3
# * Looping through all the tracks in playlist/album/track
for track in tracks:
    print(f"Dowloading: {track.name} ...")

    # * Downloading track
    mp3 = _boltzController.download_track(track)

    # * Setting tags in mp3 file
    ASSERT(_boltzController.set_tags(mp3, len(tracks)), "Error: while converting to mp3")

    print(f"Downloaded: {track.name}")

Wallah!

code to download songs from playlist

from inc import *
from boltz import *

# * Loading client_id and client_secret for boltz api
load_dotenv()
CLIENT_ID = os.getenv('CLIENT_ID')
CLIENT_SECRET = os.getenv('CLIENT_SECRET')

# * Initializing boltz controller
_boltzController = Boltz(CLIENT_ID, CLIENT_SECRET, "[download path]")

# * Passing in pl link
url = _boltzController.initialize_url("[playlist url]")
ASSERT(url.is_valid, "Error: Spotify url is not valid")

tracks = _boltzController.fetch_tracks(url)
ASSERT(tracks, "Error: while fetching tracks")

# * Looping through all the tracks in playlist/album/track
for track in tracks:
    print(f"Dowloading: {track.name} ...")

    # * Downloading track
    mp3 = _boltzController.download_track(track)

    # * Setting tags in mp3 file
    ASSERT(_boltzController.set_tags(mp3, len(tracks)), "Error: while converting to mp3")

    print(f"Downloaded: {track.name}")

Searching songs through Boltz api

from boltz import *

# * Loading client_id and client_secret for boltz api
load_dotenv()
CLIENT_ID = os.getenv('CLIENT_ID')
CLIENT_SECRET = os.getenv('CLIENT_SECRET')

# Creating boltz controller
_boltzController = Boltz(CLIENT_ID, CLIENT_SECRET)

# Getting results of Phonk
results = _boltzController.search_song("Phonk",BoltzSearchTypes.playlist,50)

# Looping through each result
for result in results:
    print(result.title + ":" + result.url.id + ":" + str(result.image.url))

boltz's People

Contributors

funk-y0u avatar fy-st0rm avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

boltz's Issues

How to pick sound quality?

I've looked through the code, but I'm wondering how to change the download quality/format of the music?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.