Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nsimonfr/deezer-playing-notifications
🎵 Reverse engineering of deezer real-time websocket messaging api to get played tracks.
https://github.com/nsimonfr/deezer-playing-notifications
deezer nowplaying reverse-engineering websocket xmpp
Last synced: 2 months ago
JSON representation
🎵 Reverse engineering of deezer real-time websocket messaging api to get played tracks.
- Host: GitHub
- URL: https://github.com/nsimonfr/deezer-playing-notifications
- Owner: nSimonFR
- License: mit
- Created: 2020-04-28T15:28:57.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-10T08:14:10.000Z (about 1 year ago)
- Last Synced: 2024-11-20T13:11:37.556Z (2 months ago)
- Topics: deezer, nowplaying, reverse-engineering, websocket, xmpp
- Language: JavaScript
- Homepage:
- Size: 36.1 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![NPM](https://nodei.co/npm/deezer-playing-notifications.png)](https://www.npmjs.com/package/deezer-playing-notifications)
# deezer-playing-notifications
Reverse engineering 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](https://github.com/nSimonFR/deezer-playing-notifications/tree/master/examples):
- [logToConsole](https://github.com/nSimonFR/deezer-playing-notifications/tree/master/examples/logToConsole.js): simply logs tracks to console
- [updateStatus](https://github.com/nSimonFR/deezer-playing-notifications/tree/master/examples/updateStatus.js): 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