npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-musixmatch-api

v1.0.0

Published

Advanced API library for seamless Musixmatch integration.

Downloads

8

Readme

Node Musixmatch API ✨🎵

An advanced API library for seamless integration with Musixmatch. 🎶

API Methods 🚀

This method requires authentication. 🔐

What does the Musixmatch API do? 🤔

The Musixmatch API allows you to read objects from our huge 100% licensed lyrics database. 📚

To make your life easier, we are providing you with one or more examples to show you how it could work in the wild. You'll find both the API request and API response in all the available output formats for each API call. Follow the links below for the details. 📝🔗

The current API version is 1.1, and the root URL is located at https://api.musixmatch.com/ws/1.1/. 🌐

Supported input parameters can be found on the page Input Parameters. Use UTF-8 to encode arguments when calling API methods. 📥

Every response includes a status_code. You can consult a list of all status codes at Status Codes. 📊

Input Parameters 📝

Use UTF-8 to encode arguments. These are the supported input parameters:

AUTHENTICATION 🔑

  • apikey - Your Personal API Key. You can set the API Key by using the setApiKey() method or in the constructor parameter.

OBJECTS 📌

  • track_id - Musixmatch track ID
  • artist_id - Musixmatch artist ID
  • album_id - Musixmatch album ID
  • commontrack_id - Musixmatch commontrack ID
  • track_mbid - MusicBrainz recording or track ID
  • artist_mbid - MusicBrainz artist ID
  • album_mbid - MusicBrainz release ID

QUERYING 🔍

  • q_track - Search for a text string among song titles
  • q_artist - Search for a text string among artist names
  • q_lyrics - Search for a text string among lyrics
  • q - Search for a text string among song titles, artist names, and lyrics

FILTERING 🧹

  • f_has_lyrics - Filter by objects with available lyrics
  • f_is_instrumental - Filter instrumental songs
  • f_has_subtitle - Filter by objects with available subtitles
  • f_music_genre_id - Filter by objects with a specific music category
  • f_subtitle_length - Filter subtitles by a given duration in seconds
  • f_subtitle_length_max_deviation - Apply a deviation to a given subtitle duration (in seconds)
  • f_lyrics_language - Filter the tracks by lyrics language
  • f_artist_id - Filter by objects with a given Musixmatch artist ID
  • f_artist_mbid - Filter by objects with a given MusicBrainz artist ID

GROUPING 🧩

  • g_commontrack - Group a track result set by commontrack_id

SORTING 🔄

  • s_track_rating - Sort the results by our popularity index for tracks. Possible values are ASC | DESC
  • s_track_release_date - Sort the results by track release date. Possible values are ASC | DESC
  • s_artist_rating - Sort the results by our popularity index for artists. Possible values are ASC | DESC

RESULT SET PAGINATION 📄

  • page - Request a specific result page (default=1)
  • page_size - Specify the number of items per result page (default=10, range is 1 to 100)

OUTPUT FORMAT 📋

  • subtitle_format - Desired output format for the subtitle body. Possible values are LRC|DFXP|STLEDU. Defaults to LRC.

LOCALIZATION 🌍

  • country - The country code of the desired country.

Example Usage 🌟

const { Musixmatch } = require('node-musixmatch-api');
const mxm = new Musixmatch('YourAPIKeyHere');

mxm
  .trackSearch(
    'q_artist=Money Man Lil Baby',
    'q_track=24',
    's_track_rating=78',
    'q=VPN'
  )
  .then((l) => {
    console.log(l.message.body.track_list[0].track.album_name);
    trackId = l.message.body.track_list[0].track.track_id;
  });

AutoComplete 🆒

Most of the functions have the AutoComplete feature. 🤩

Some of them don't have AutoComplete. In that case, you can make your own AutoComplete Interface by using the BaseInterface interface. (Only works with TypeScript) 💡

const { BaseInterface, Musixmatch } = require('node-musixmatch-api');

const mxm = new Musixmatch('APIKEYHERE');

interface AutoCompleteInterface extends BaseInterface {
  message: {
    header: {
      status_code: number;
      execute_time: number;
    };
    body: {
      suggestions: string[]; // Example property for AutoComplete suggestions
    };
  };
}

const getTrackInfo = async (): AutoCompleteInterface => {
  const l = await mxm.trackSearch(
    'q_artist=Money Man Lil Baby',
    'q_track=24',
    's_track_rating=78',
    'q=VPN'
  );
  return l;
};

Feel free to explore different methods 🌟 with your creativity! ✨