Giter Club home page Giter Club logo

spotify-dl-lib's Introduction

spotify-dl-lib

A rust library which allows you to download spotify songs if you have a premium account

Features

  • Download tracks, albums, and playlists
  • Supports mp3 (enable the mp3 feature) and flac format
  • Configurable download concurrency and compression (compression only applies to flac!)

How to use this library

get your spotify username (your username is not your display name) and password ready

in case you do not know how to get your spotify username here is a quick tutorial

  1. spotify_screenshot_1
  2. spotify_Screenshot_2
  3. and now you should have your spotify profile url in your clipboard, in my case, this is my profile url: https://open.spotify.com/user/xfvf8ol1ezj9bv5la7ty0vzut?si=8a8b7c4b7c5746df
  4. this is the important part we need from the url: xfvf8ol1ezj9bv5la7ty0vzut, save this for later

if your application uses a UI, a websocket server is exposed at ws://127.0.0.1:4040 :)) an example project will be very soon coming on my github which uses this websocket :D

example

use spotify_dl_lib::SpotifyDownloader;

#[tokio::main]
async fn main() {
    let username = "your username here";
    let password = "your spotify password here";

    let output_folder = PathBuf::from("./spotify-dl-data")

    //first argument is the name of the folder, where your mp3 files will be dropped (folder will be created in your home dir)
    let spotify_dl = SpotifyDownloader::new(&output_folder, &username, &password, Some("ws://127.0.0.1:4040/ws".to_string())).await.unwrap();

    //download a playlist, album or track!
    let tracks_to_dl = vec![
       "https://open.spotify.com/playlist/7lzJ7tSe2N6Cvbsjto4lrq?si=09e7c2f655a840c5".to_string()
    ];


    /*
    download the tracks
    (2nd argument = parallelism of how many files can be downloaded concurrently (default value is 5 if None))
    (3rd argument = compression rate (only for flac format), lower = faster! higher = takes longer due of more processing (default value is 4 if None)
    (4th argument = file format, yea the output of your file bruh (only flac and mp3 are supported at the moment)
    */
    spotify_dl.download_tracks(tracks_to_dl, None, None, "mp3").await.unwrap();

    println!("download finished!");

}

Important!!

Using this project is against Spotifys ToS, use it at your own risk. I am not responsible for any damanges/limitations caused to your Spotify Account.

Credits

This project was only possible due of the existence of this amazing project <3 much love to all of you. If you are looking for a CLI solution for just downloading spotify tracks, stick to the mentioned project instead.

spotify-dl-lib's People

Contributors

klover-rs avatar

Stargazers

Guillem Castro avatar  avatar  avatar  avatar Alexey avatar CryptoKing0720 avatar

Watchers

 avatar

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.