deezer 1.1.0

SDKdartflutter
Platformandroidioswindowslinuxmacos

A Dart package for downloading music from Deezer, equipped with robust functions and features.

Deezer Dart Package

pub: deezer License: AGPL style: lint

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.

  • arl Parameter: 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 arl key will expire after approximately 3 months. Make sure to refresh it when needed to continue using the package seamlessly.

Installation

To use this package

  1. With Dart:
    $ dart pub add deezer
    
  2. With Flutter:
    $ flutter pub add deezer
    
  3. With pubspec.yaml
    dependencies:
      deezer: ^version_number
    

    Run dart pub get or flutter pub get to install the package.

Usage

  1. Import the Package: Import the deezer package in your Dart file:

    import 'package:deezer/deezer.dart';

  2. Obtain ARL Parameter: Obtain the arl parameter from your Deezer account's browser cookies. This parameter is required to authenticate your requests to the Deezer API.

  3. Create Deezer Instance: Use the obtained arl parameter to create a Deezer instance:

    String arl = "get it from your browser cookies";
    Deezer deezer = await Deezer.create(arl: arl);
    

    Album Functions

    FunctionDescription
    getAlbumGet album information
    getAlbumTracksGet album tracks

    Artist Functions

    FunctionDescription
    getArtistGet artist information
    getArtistTopTracksGet artist top tracks
    getArtistAlbumsGet artist albums
    getArtistRelatedGet related artists
    getArtistRadiosGet artist radios
    getArtistPlaylistsGet artist playlists

    Chart Functions

    FunctionDescription
    getChartGet chart
    getChartTopTracksGet chart top tracks
    getChartTopAlbumsGet chart top albums
    getChartTopArtistsGet chart top artists
    getChartTopPlaylistsGet chart top playlists
    getChartTopPodcastsGet chart top podcasts

    Editor Functions

    FunctionDescription
    getEditorialGet editorial
    getEditorialsGet editorials

    Genre Functions

    FunctionDescription
    getGenreGet genre details
    getGenresGet details list of genres
    getGenreArtistsGet genre artists
    getGenreRadiosGet genre radios

    Playlist Functions

    FunctionDescription
    getPlaylistGet playlist details
    getPlaylistTracksGet playlist tracks

    Radio Functions

    FunctionDescription
    getRadioGet radio details
    getRadioTracksGet radio tracks
    getRadioGenresGet radio genres
    getRadioTopGet top radios
    getRadioListsGet radio lists

    Search Functions

    FunctionDescription
    searchAlbumsSearch for albums
    searchArtistsSearch for artists
    searchPlaylistsSearch for playlists
    searchTracksSearch for tracks
    searchUsersSearch for users
    searchRadiosSearch for radios

    User Functions

    FunctionDescription
    getUserGet user details
    getUserAlbumsGet user albums
    getUserArtistsGet user artists
    getUserTracksGet user tracks
    getUserRadiosGet user radios
    getUserChartTracksGet user chart tracks
    getUserChartAlbumsGet user chart albums
    getUserChartArtistsGet user chart artists
    getUserChartPlaylistsGet user chart playlists
    getUserFlowGet user flow
    getUserFollowingsGet user followings
    getUserFollowersGet user followers
    getUserPlaylistsGet user playlists

    Track Functions

    FunctionDescription
    getTrackGet track details
    getTracksGet track details list

    Favorite Functions

    FunctionDescription
    favSongsGet favorite songs
    addFavSongsAdd favorite songs
    removeFavSongsRemove favorite songs

    Download Functions

    FunctionDescription
    getSongDownload a song
    streamSongStream a song
  4. Download a Song: Use the getSong method 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!);
    }      
    
  5. Stream a Song: Use the streamSong method 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.