Crates.io | spotify_dl_lib |
lib.rs | spotify_dl_lib |
version | 0.3.21 |
source | src |
created_at | 2024-05-25 17:47:34.567424 |
updated_at | 2024-06-23 15:30:52.224284 |
description | A rust library which allows you to download spotify songs if you have a premium account |
homepage | |
repository | https://github.com/mari-rs/spotify-dl-lib |
max_upload_size | |
id | 1252097 |
size | 42,484 |
A rust library which allows you to download spotify songs if you have a premium account
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
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
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!");
}
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.
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.