Deezer Dart Package
A Dart package for easy music downloading from Deezer.
Overview
The Deezer Dart package provides a convenient way to interact with the Deezer music streaming platform in Dart applications. With this package, developers can easily search for songs, retrieve track information, fetch favorite songs, and download music from Deezer.
Future
- Search functionality for songs
- Expanded track information retrieval
- Batch operations for fetching track information
- Playlist support
- Optimization for song downloading
- Capability to retrieve favorite songs
- Manage favorite songs (add and delete)
- Stream songs
Prerequisites
Before using this package, ensure you have the following:
-
Deezer Account: You don't need a Deezer subscription. Simply create a Deezer account.
-
arlParameter: Obtain the arl parameter from your Deezer account's browser cookies. This parameter is necessary to authenticate your requests to the Deezer API.Note: The
arlkey will expire after approximately 3 months. Make sure to refresh it when needed to continue using the package seamlessly.
Installation
To use this package
- With Dart:
$ dart pub add deezer - With Flutter:
$ flutter pub add deezer - With pubspec.yaml
dependencies: deezer: ^version_numberRun
dart pub getorflutter pub getto install the package.
Usage
-
Import the Package: Import the
deezerpackage in your Dart file:import 'package:deezer/deezer.dart'; -
Obtain ARL Parameter: Obtain the
arlparameter from your Deezer account's browser cookies. This parameter is required to authenticate your requests to the Deezer API. -
Create Deezer Instance: Use the obtained
arlparameter to create a Deezer instance:String arl = "get it from your browser cookies"; Deezer deezer = await Deezer.create(arl: arl); -
Search for a Song: Use the
searchmethod to search for a song:var searchResult = await deezer.search("Hello"); -
Get Track Information: Use the
getTrackmethod to retrieve information about a specific track:var trackInfo = await deezer.getTrack("138545995"); -
Get Tracks Information: Use the
getTracksmethod to retrieve information about multiple tracks:var tracksInfo = await deezer.getTracks(["138545995", "1439299952"]); -
Get Favorite Songs: Use the
favSongsmethod to retrieve information about favorite songs:var favoriteSongs = await deezer.favSongs(); -
Add Favorite Songs: Use the
addFavSongsmethod to add songs to favorites:bool addFav = await deezer.addFavSongs(["1439299952"]); print("Add Favorites: $addFav"); -
Remove Favorite Songs: Use the
removeFavSongsmethod to remove songs from favorites:bool removeFav = await deezer.removeFavSongs(["1439299952"]); print("Remove Favorites: $removeFav"); -
Download a Song: Use the
getSongmethod to download a song:final song = await deezer.getSong("1439299952");Write the downloaded song to a file:
if (song?.data != null) { File file = File("song.mp3"); file.writeAsBytesSync(song.data!); } -
Stream a Song: Use the
streamSongmethod to stream a song:final stream = deezer.streamSong("1439299952");Write the streamed song to a file:
File streamFile = File("stream_song.mp3"); IOSink sink = streamFile.openWrite(); await for (List<int> chunk in stream) { sink.add(chunk); } await sink.flush(); await sink.close();
Ensure to replace
["1439299952"]with the actual list of song IDs you want
External Libraries
Contributing
Contributions are welcome! If you'd like to contribute to this package
See contributing.md for ways to get started.
Please adhere to this project's code of conduct.
Libraries
- deezer
- Support for doing something awesome.