A Node JS wrapper client for fetching public data from LastFm API.
Fetch server side or client side, thanks to cross-fetch
Install the npm package in your project.
pnpm install
Consider PNPM
Import the client module:
import { lastFm } from 'lastfm-nodejs-client';
Import the Types as type:
import type {
Artist,
Track,
User,
WeeklyAlbum,
} from 'lastfm-nodejs-client/dist/@types/lastfm.types';
Working on getting these into DefinitelyTyped
const lastFm = LastFmApi();
const { config, method } = lastFm;
const getTopArtists = async () => {
const data = await lastFm.getTopArtists(
method.user.top_artists,
config.username,
'overall',
'200',
);
const { topartists } = data;
return topartists;
};
🚀 Gives you:
Written in TypeScript, compiles down to ES2015, provides the types for the lastFm entities.
gh repo fork mannuelf/lastfm-nodejs-client
What's gh? Get it here
A list of endpoints currently mapped to this client. Still under development, not feature complete.
Create .env
file in project root:
You do not need an API key to query the public USER entity, add only base url and a username to env file.
LASTFM_API_BASE_URL=""
LASTFM_USER=""
For everything else you will need to include:
LASTFM_API_KEY=""
LASTFM_APPNAME=""
Create them here.
pnpm test
pnpm lint
pnpm lint-fix
pnpm build
pnpm prepare
pnpm publish
I was building a scrobbles page https://mannuelferreira.com/scrobbles and I thought others might want it to.
- move types into DefinitelyTyped