# deezer-playing-notifications

> Reverse ingeneering of deezer real-time websocket messaging api to get played tracks.

Latest version **0.1.2** (published 2020-04-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install deezer-playing-notifications
pnpm add deezer-playing-notifications
yarn add deezer-playing-notifications
bun add deezer-playing-notifications
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2020-04-28 |
| First published | 2020-04-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 (+25 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 4 |
| Author | nSimonFR |
| Maintainers | nsimon |

## Links

- npm: https://www.npmjs.com/package/deezer-playing-notifications
- Repository: https://github.com/nSimonFR/deezer-playing-notifications
- Homepage: https://github.com/nSimonFR/deezer-playing-notifications#readme
- Issues: https://github.com/nSimonFR/deezer-playing-notifications/issues
- npm.io page: https://npm.io/package/deezer-playing-notifications

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.19.2
- [@xmpp/debug](https://npm.io/package/@xmpp/debug.md) ^0.11.0
- [@xmpp/client](https://npm.io/package/@xmpp/client.md) ^0.11.1

## Recent versions

- 0.1.2 (latest) — 2020-04-28
- 0.1.1 — 2020-04-28
- 0.1.0 — 2020-04-28

## README

# deezer-playing-notifications

Reverse ingeneering of deezer real-time websocket messaging api to get played tracks.

This allows to make a small [lastfm](https://last.fm/)-like self-hosted service.

## Usage:

You will need a USERID _(Deezer userId)_ and TOKEN _(From [deezer api](https://developers.deezer.com) or from your browser cache)_:

```js
const Deezer = require("deezer-playing-notifications");

const xmpp = new Deezer(USERID, TOKEN).initializeXMPP();
xmpp.on("track", (trackId) => console.log("Track ID:", trackId));
xmpp.start();
```

## API

`new Deezer()` requires a valid userId and token to connect.

`initializeXMPP` method returns an [xmpp client](https://www.npmjs.com/package/@xmpp/client), you may listen to any events as you normally would.

It also introduces a new event: `"track"` which sends the `songId` on track change.

Deezer also exposes the following static method:

- `getSong` (async) which takes a songId and returns a deezer [track](https://developers.deezer.com/api/track)

## Examples

Available [here](examples):

- [logToConsole](examples/logToConsole.js): simply logs tracks to console
- [updateStatus](examples/updateStatus): updates discord status on track change

## Contributing & LTS

Contributions are welcomed, just consider this more as a POC rather than a real library, compatibility may break at any moment and I cannot garantee support.

Ideas of what could be added / updated:

- Basic configuration (eslint/prettier etc)
- Tests to ensure compatibility (jest preffered)
- Rewrite in typescript
- Support for other types of messages.

MIT @ nSimonFR

---
_Source: https://npm.io/package/deezer-playing-notifications · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
