@chirag127/listenbrainz
v1.0.0
Published
ListenBrainz API client — listens, now-playing, stats
Maintainers
Readme
@chirag127/listenbrainz
ListenBrainz API client. Zero auth needed for public user data.
Install
npm install @chirag127/listenbrainzUsage
import {
getRecentListens,
getPlayingNow,
getArtistStats,
getRecordingStats,
getListenCount,
} from '@chirag127/listenbrainz';
const listens = await getRecentListens('chirag127', 50);
const nowPlaying = await getPlayingNow('chirag127'); // null if not playing
const artists = await getArtistStats('chirag127', 'month', 10);
const recordings = await getRecordingStats('chirag127', 'week', 10);
const count = await getListenCount('chirag127');API
All functions are async and return parsed JSON payload fields.
| Function | Params | Returns |
|---|---|---|
| getRecentListens(username, count=100) | username, count | listens array |
| getPlayingNow(username) | username | single listen or null |
| getArtistStats(username, range='month', count=50) | username, range, count | stats payload |
| getRecordingStats(username, range='month', count=50) | username, range, count | stats payload |
| getListenCount(username) | username | number |
range values: week, month, quarter, half_yearly, year, all_time.
Base URL: https://api.listenbrainz.org
