npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

diezel

v1.1.1

Published

Private Deezer client for Node

Readme

Diezel

A library for the private Deezer API ("Gateway API") and other private APIs. By default, the library doesn't come with keys to decrypt audio streams, nor does it come with API access keys for the mobile API. You will have to find these yourself.

Installation

Via npm:

npm install diezel

Read This First

See this for more info

Due to Deezer's habit of sending DMCA requests to similar repositories, the keys that are hardcoded into various Deezer platforms are not included here.

| Key | Explanation | | ---------------- | ----------------------------------------------------------------------------- | | TRACK_XOR_KEY | Key used to derive a decryption key for an encrypted song | | MOBILE_GW_KEY | (MobileClient only) Private key for decrypting an encrypted gateway token | | MOBILE_API_KEY | (MobileClient only) API key for the mobile gateway API |

You can set the keys as soon as the library is required:

const diezel = require('diezel');
diezel.setKeys(/* key object */);

Alternatively, you can also pass in keys through environment variables (with DIEZEL_ prepended):

$ DIEZEL_TRACK_XOR_KEY=blahblah node
> const diezel = require('diezel');

Which Client Should I Use?

For core Deezer services, Diezel implements a "mobile" client (as implemented in the Deezer mobile apps) and a "web" client (as implemented on the desktop site). Both clients have their advantages and disadvantages in terms of key availability.

MobileClient

This is the most complete client that is currently implemented. Unlike many other implementations of the Deezer private API it doesn't rely on the web client for getting an SID or ARL. This means the user can sign in without having to pass a captcha. One major caveat of using this client is it requires two hardcoded keys - the API key, which is easily obtainable, and the gateway key, which is not. The client is already set up to impersonate an Android device so it would be wise to start there if you wish to obtain the keys.

WebClient

This client is still a work in progress. It doesn't require any keys but it requires passing a captcha for logging in.

Getting started with MobileClient

Once you have all the relevant keys:

const diezel = require('diezel');
const { MobileClient } = diezel.clients;
const { ImageUrl, SongAsset, LegacyFormat } = diezel.content;

// Create client
const mobileClient = new MobileClient();

// Sign in
const result = await mobileClient.signInWithEmail('[email protected]', 'password')
if (result) {
    console.log('Signed in!');
} else {
    console.error('Incorrect credentials!');
}

// Restore session
const userInfo = mobileClient.userInfo;
// ...
const newClient = new MobileClient(userInfo);
await newClient.restoreSession();

// Get an album
const album = await mobileClient.getAlbum(122475762);

// Get album art URL
const albumArtUrl = ImageUrl.forObject(album.DATA).toString({dimensions: {width: 500, height: 500}});

// Get song stream
const song = album.SONGS.data[5];
const stream = await newClient.mediaClient.getSongStreams([song], ['MP3_128']);
const decryptedStream = await stream.getDecryptedStream();

// Pipe it to a file
const fs = require('fs');
const file = fs.openWriteStream('song.mp3');
decryptedStream.pipe(file);

GraphQL API

Deezer have now implemented a new GraphQL API. While not included in this package, Diezel allows you to easily use it once authenticated using one of the above clients. You can easily obtain the required authorization token of the currently signed in user:

const diezel = require('diezel');
const { MobileClient } = diezel.clients;

// Create client
const mobileClient = new MobileClient();

// Sign in
await mobileClient.signInWithEmail('[email protected]', 'password');

// Get and print the auth token
const token = await mobileClient.retrieveAuthToken();
console.log(token.jwtToken);

Now, in conjunction with the base API URL https://pipe.deezer.com/api, it is possible to list all of the queries and mutations in a client like Postman.

Testing

Testing requires that keys be present. See readme.md in the test/ directory.