🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

musicxmatch-api

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

musicxmatch-api

A lightweight TypeScript wrapper for the Musixmatch API with automatic signature generation.

1.0.1
latest
Source
npm
Version published
Weekly downloads
4
-75%
Maintainers
1
Weekly downloads
 
Created
Source

🎵 Musixmatch API

musicxmatch-api is an npm package that provides easy access to MusixMatch API endpoints. It supports searching tracks, getting track details, lyrics, artists, albums, and more. This package handles the necessary signing and authentication required by MusixMatch.

Time I spent on this project so far wakatime

Took me 1 hr 28 mins 56 secs to build this package. image

✨ Features

  • Fetch lyrics, tracks, albums, and artists
  • Automatically fetches app signature from Musixmatch
  • Proxy support built-in (currently not used internally)
  • Fully typed (TypeScript support)

📦 Installation

npm install musixmatch-api
pnpm install musixmatch-api
yarn add musixmatch-api
bun install musixmatch-api

Requires Node.js 16+

Usage

Here's how you can use the MusixMatchAPI class to interact with the MusixMatch API:

Importing the Package

import { MusixMatchAPI } from "musicxmatch-api";

Creating an Instance

const musixMatchAPI = new MusixMatchAPI();

Available Methods

searchTracks(options: { query?: string; track?: string; artist?: string; page: number; }): Promise<SearchTracksResponse>

Search for tracks based on the provided options.

const tracks = await musixMatchAPI.searchTracks({
  query: "love",
  track: "Shape of You",
  artist: "Ed Sheeran",
  page: 1,
});

getTrack(trackId?: string | null, trackIsrc?: string | null): Promise<GetTrackResponse>

Get track details by track ID or ISRC.

const track = await musixMatchAPI.getTrack("123456");

getTrackLyrics(trackId?: string | null, trackIsrc?: string | null): Promise<GetLyricsResponse>

Get lyrics of a track by track ID or ISRC.

const lyrics = await musixMatchAPI.getTrackLyrics("123456");

searchArtist(query: string, page?: number): Promise<SearchArtistsResponse>

Search for artists by name.

const artist = await musixMatchAPI.searchArtist("Queen");

getArtist(artistId: string): Promise<GetArtistResponse>

Get artist details by artist ID.

const artist = await musixMatchAPI.getArtist("118");

getArtistAlbums(artistId: string, page?: number): Promise<GetArtistAlbumsResponse>

Get albums of an artist by artist ID.

const albums = await musixMatchAPI.getArtistAlbums("118");

getAlbum(albumId: string): Promise<GetAlbumResponse>

Get album details by album ID.

const album = await musixMatchAPI.getAlbum("32541950");

getAlbumTracks(albumId: string, page?: number): Promise<GetAlbumTracksResponse>

Get tracks of an album by album ID.

const tracks = await musixMatchAPI.getAlbumTracks("32541950");

getTrackLyricsTranslation(trackId: string, language: string): Promise<GetTrackLyricsTranslationResponse>

Get lyrics translation of a track by track ID and language.

const translation = await musixMatchAPI.getTrackLyricsTranslation("123456", "es");

rawRequest(endpoint: string): Promise<any>

Make a raw request to any MusixMatch API endpoint.

const response = await musixMatchAPI.rawRequest("track.get?app_id=community-app-v1.0&format=json&track_id=123456");

Example

import { MusixMatchAPI } from "musicxmatch-api";

const musixMatchAPI = new MusixMatchAPI();

async function fetchTrackDetails() {
  try {
    const track = await musixMatchAPI.getTrack("123456");
    console.log(track);
  } catch (error) {
    console.error("Error fetching track details:", error);
  }
}

fetchTrackDetails();

License

This package is licensed under the MIT License. Feel free to use, modify, and distribute it as per the terms of the license.

Keywords

musixmatch

FAQs

Package last updated on 06 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts