Skip to content

redteadeveloper/Music-Info

Repository files navigation

music-info

NPM NPM NPM NPM NPM

NPM module for searching songs and albums.

Usage

Searching for Songs

Usage: searchSong(term, options)

  • term<String>: The term you want to search up for.
  • options<Object>: Optional; Option for specifying details of the song.
    • artist<String>: The artist name of the song you are searching for.
    • album<String>: The album title of the song you are searching for.

Tip: To fetch an artwork URL or release date, use searchAlbum instead.

Click to see the returned array (promise)

[
  {
    type: 'song',
    title: String, // title of the song
    artist: String, // artist of the song
    album: String, // title of the album
    genre: String, // genre of the song
    trackNumber: Number, // track number of the song
    trackLength: Number, // length of the track in milliseconds
    available: Boolean, // availability on iTunes
    explicit: Boolean
  },
  // continues...
]

Searching for Albums

Usage: searchAlbum(term, options)

  • term<String>: The term you want to search up for.
  • options<Object>: Optional; Option for specifying details of the album & artwork size.
    • artist<String>: The artist name of the album you are searching for.
    • artworkSize<Number>: The artwork size you want to get. Default value is 60.
Click to see the returned array (promise)

[
  {
    type: 'album',
    title: String,
    artist: String,
    trackCount: Number,
    genre: String,
    releaseDate: Date,
    explicit: Boolean,
    artwork: String
  },
  // continues...
]

Searching for Lyrics

To be added later.

Examples

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

musicInfo.searchSong('elegy dedicated with love', { artist: 'ophelia' }).then(data => {
  console.log(data); // [ { type: 'song', title: 'Elegy Dedicated with Love', ... }, ... ]
});

musicInfo.searchAlbum('traveler', { artist: 'official hige dandism', artworkSize: 100 }).then(data => {
  console.log(data); // [ { type: 'album', title: 'Traveler', artist: 'OFFICIAL HIGE DANDISM', ... }, ... ]
});