Important
Artwork inspired by ElysiaJS.
npm install @andreafspeziale/mxm-apiyarn add @andreafspeziale/mxm-apipnpm add @andreafspeziale/mxm-apiNote
To effectively interact with the Musixmatch API you need a valid API key.
The SDK implements most of the Musixmatch API endpoints, providing a strongly typed and easy-to-use interface for developers. It handles authentication, request construction and response parsing allowing you to focus on building your application.
import { MxmAPI } from '@andreafspeziale/mxm-api';
const mxmAPI = new MxmAPI();
const track = await mxmAPI.trackGet({
track_isrc: 'USUM72005901',
apiKey: 'your-api-key',
});import { MxmAPI } from '@andreafspeziale/mxm-api';
const mxmAPI = new MxmAPI({
config: {
apiKey: 'your-api-key',
},
});
const track = await mxmAPI.trackGet({
track_isrc: 'USUM72005901',
});A Pino basic logger instance is created internally when
enableLogis set totrue.
import { MxmAPI } from '@andreafspeziale/mxm-api';
const mxmAPI = new MxmAPI({
config: {
apiKey: 'your-api-key',
enableLog: true,
defaultLoggerConfig: {
formatters: {
level: (label) => {
return { level: label };
},
},
},
},
});
const track = await mxmAPI.trackGet({
track_isrc: 'USUM72005901',
});A Pino logger instance is provided and logging can be enabled/disabled via configuration.
import { pino } from 'pino';
import { MxmAPI } from '@andreafspeziale/mxm-api';
const logger = pino({
formatters: {
level: (label) => {
return { level: label };
},
},
});
const mxmAPI = new MxmAPI({
logger,
config: {
apiKey: 'your-api-key',
enableLog: true,
},
});
const track = await mxmAPI.trackGet({
track_isrc: 'USUM72005901',
});matcherLyricsGet(matcher.lyrics.get)matcherSubtitleGet(matcher.subtitle.get)matcherTrackGet(matcher.track.get)
trackGet(track.get)trackLyricsGet(track.lyrics.get)trackLyricsMoodGet(track.lyrics.mood.get)trackSubtitleGet(track.subtitle.get)trackRichSyncGet(track.richsync.get)trackSearch(track.search)
trackLyricsFingerprintPost(track.lyrics.fingerprint)
Note
To keep consistency over time and to be sure each endpoint returns the expected result, e2e tests are run against the actual Musixmatch APIs when a valid API key is provided (environment variable MUSIXMATCH_API_KEY). Instead e2e will be skipped.
pnpm test
- Author - Andrea Francesco Speziale
mxm-api MIT licensed.
