Skip to content

redteadeveloper/Music-Info

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

music-info

NPM NPM NPM NPM NPM

npm module for searching songs and albums.

Usage

Parameters

  • term<String>: The term you want to search up for.
  • option<Object>: Object for additional options when searching up.
    • type<String>: all | song | album
      • The type of media you want to search up for. Default is all.
    • artworkSize<Number>: Size of the artwork. Default is 600.
    • length<Number>: The number of results you want to get. Default is 3.

Overall search

Don't pass any configuration in order to search for anything that matches the search keyword. Or you can set the type to all in order to achieve the same result.

const musicInfo = require('music-info');

musicInfo.search("I'm not the only one").then(console.log);

Song search

const musicInfo = require('music-info');

musicInfo.search('November Rain', { type: 'song', artworkSize: 1000 }).then(console.log);
  • 1000 is the size of the artwork. Default value is 600.
  • artist and album parameters are optional.
Click to see the returned object (promise)

{
  type: 'song',
  title: String, // title of the song
  artist: String, // artist of the song
  available: Boolean, // on iTunes
  explicit: Boolean,
  length: String, // ex. 3:30 for 3 minutes 30 seconds long
  album: { // info of the album
    type: 'album',
    title: String, // title of the album
    artist: String, // artist of the album
    trackCount: Number,
    genre: String,
    releaseDate: Date,
    explicit: Boolean,
    artwork: String
  }
}

Album search

const musicInfo = require('music-info');

musicInfo.search('appetite for destruction', { type: 'album' }).then(console.log);
  • 1000 is the size of the artwork. Default value is 600.
  • artist parameter is optional.
Click to see the returned object (promise)

{
  type: 'album',
  title: String,
  artist: String,
  trackCount: Number,
  genre: String,
  releaseDate: Date,
  explicit: Boolean,
  artwork: String
}

Lyrics search

const musicInfo = require("music-info");

musicInfo.getLyrics("since i don't have you", { artist: 'Guns N Roses' }).then(console.log);
  • artist parameter is optional.
Click to see the returned object (promise)

{
  url: String,
  lyrics: String
}