DeezNET 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package DeezNET --version 0.1.0                
NuGet\Install-Package DeezNET -Version 0.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DeezNET" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DeezNET --version 0.1.0                
#r "nuget: DeezNET, 0.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DeezNET as a Cake Addin
#addin nuget:?package=DeezNET&version=0.1.0

// Install DeezNET as a Cake Tool
#tool nuget:?package=DeezNET&version=0.1.0                

DeezNET

A .NET Deezer API wrapper and track downloading library. There's a CLI tool in there as well.

This library hasn't been super tested, but it's not that complex so it should be fine.

Dear Deezer

If you would like this repository to be taken down, please send me a cease and desist.<br> You may e-mail it to me here: me@trev.app.

Or go through the standard GitHub DMCA procedure, but that isn't as fun.

Dependencies

Overview

DeezNET is built around a core class, DeezerClient. That class itself does very little, under it is Downloader, GWApi, and PublicApi.

  • Downloader provides functions for downloading tracks by their ID, as well as applying metadata. It requires an ARL supplied to DeezerClient to function.
  • GWApi is a wrapper for the backend API used by Deezer. It requires an ARL supplied to DeezerClient to function.
  • PublicApi is a wrapper for the public Deezer API. It does not require an ARL.

All API calls return a Newtonsoft.JSON JToken as I did not want to deal with parsing everything into model classes since there are many different API endpoints.

In addition to DeezerClient, there is DeezerURL which is a class for parsing Deezer URLs into their entity type and ID. It also handles unshortening the standard Deezer share URLs (deezer.page.link).

Examples

Getting Track Info (PublicApi)

var client = await DeezerClient.Create();
var trackData = await client.PublicApi.GetTrack(1903638027);
Console.WriteLine($"{trackData["title"]!} by {trackData["contributors"]!.First()["name"]!}");
// Output: Let You Down by Dawid Podsiadło

Getting Track Info (GWApi)

var client = await DeezerClient.Create("[ARL]");
var trackData = await client.GWApi.GetTrack(1903638027);
Console.WriteLine($"{trackData["SNG_TITLE"]!} by {trackData["ART_NAME"]!}");
// Output: Let You Down by Dawid Podsiadło

Downloading a Track by ID

var client = await DeezerClient.Create("[ARL]");
var trackBytes = await client.Downloader.GetRawTrackBytes(1903638027, DeezNET.Data.Bitrate.FLAC);
trackBytes = await client.Downloader.ApplyMetadataToTrackBytes(1903638027, trackBytes); // if you want metadata
File.WriteAllBytes(Path.Combine(Environment.CurrentDirectory, "LYD.flac"), trackBytes);
// Saves a metadata-applied FLAC of Let You Down by Dawid Podsiadło to your current working directory

Downloading an Album by URL

var client = await DeezerClient.Create("[ARL]");
var urlData = DeezerURL.Parse("https://deezer.page.link/uwdUFsjkJbGkngSm7"); // this is a short URL, can also be a full one like "https://www.deezer.com/us/album/548556802"
var tracksInAlbum = await urlData.GetAssociatedTracks(client);

foreach (var track in tracksInAlbum)
{
    var trackBytes = await client.Downloader.GetRawTrackBytes(track, DeezNET.Data.Bitrate.FLAC);
    trackBytes = await client.Downloader.ApplyMetadataToTrackBytes(track, trackBytes); // if you want metadata
    File.WriteAllBytes(Path.Combine(Environment.CurrentDirectory, $"{track}.flac"), trackBytes);
}
// Saves metadata-applied FLACs of every track in GLOOM DIVISION by I DONT KNOW HOW BUT THEY FOUND ME to your current working directory

DeezCLI

USAGE
  DeezCLI <url> [options]

DESCRIPTION
  Downloads the given URL.

PARAMETERS
* url               The URL of the item to download. Can be a shortened URL.

OPTIONS
  -b|--bitrate      The preferred bitrate when downloading. Falls back to a lower quality if unavailable. Choices: "MP3_128", "MP3_320", "FLAC". Default: "FLAC".
  -m|--add-metadata  Whether to attach metadata to the downloaded audio file. Default: "True".
  -o|--output       The directory to save downloaded media to. Default: Current Working Directory.
  -a|--arl          The account ARL to download with. A paid plan allows for higher quality downloads. Some regions do not have full tracks available without a premium account. Default: "".
  -l|--top-limit    The max amount of tracks to download. Only applicable when downloading an artist's top tracks. Default: "100".
  -c|--concurrent   The max amount of allowed concurrent track downloads. Default: "3".
  -h|--help         Shows help text.
  --version         Shows version information.

Credits

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.0 193 8/22/2024
1.1.2 120 8/18/2024
1.1.1 119 6/28/2024
1.1.0 109 6/28/2024
1.0.0 69 5/26/2024
0.1.0 122 5/5/2024