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 🙏

© 2025 – Pkg Stats / Ryan Hefner

musicartistinfo

v1.0.1

Published

This project is a lightweight npm library designed to interact with the Deezer API, providing simple and reusable functions to retrieve artist-related information.

Readme

musicArtistInfo

A lightweight npm library for interacting with the Deezer API to fetch artist-related data, including artist IDs, top songs, and artist details such as fan count and number of albums. This library uses asynchronous JavaScript functions with the Fetch API for efficient, non-blocking operations.

Installation

To install the library, run:

npm install musicArtistInfo

Usage

Import the library in your project:

const musicArtistInfo = require('musicArtistInfo');

The library provides two types of functions:

  • Functions ending with Func: These return data for programmatic use and are typically used internally by other functions.
  • Functions without Func: These are user-facing, logging results directly to the console for quick testing or debugging.

Below is a detailed explanation of each function.

Functions

getIdByNameFunc(name)

Description: Retrieves the Deezer artist ID for a given artist name. This function is designed for internal use by other functions.

Parameters:

  • name (string): The name of the artist (e.g., "Ariana Grande").

Returns: A promise resolving to the artist's ID (number).

Example:

musicArtistInfo.getIdByNameFunc("Ariana Grande").then(id => console.log(id));
// Returns: 1562681

getIdByName(name)

Description: User-facing function that fetches and logs the artist's ID and name from the Deezer API.

Parameters:

  • name (string): The name of the artist.

Output: Logs an object containing the artist's name and ID to the console.

Example:

musicArtistInfo.getIdByName("Ariana Grande");
// Logs: { name: "Ariana Grande", id: 1562681 }

topPopularSongsByIdFunc(id, count)

Description: Retrieves the top count songs for an artist by their Deezer ID. Designed for internal use.

Parameters:

  • id (number): The artist's Deezer ID.
  • count (number): The number of top songs to retrieve.

Returns: A promise resolving to an array of objects, each containing the song title and album name.

Example:

musicArtistInfo.topPopularSongsByIdFunc(1562681, 2).then(songs => console.log(songs));
// Returns: [{ title: "Song 1", albumName: "Album 1" }, { title: "Song 2", albumName: "Album 2" }]

topPopularSongsById(id, count)

Description: User-facing function that fetches and logs the top count songs for an artist by their Deezer ID.

Parameters:

  • id (number): The artist's Deezer ID.
  • count (number): The number of top songs to retrieve.

Output: Logs an array of objects containing song titles and album names to the console.

Example:

musicArtistInfo.topPopularSongsById(1562681, 3);
// Logs: [{ title: "Song 1", albumName: "Album 1" }, { title: "Song 2", albumName: "Album 2" }, { title: "Song 3", albumName: "Album 3" }]

topPopularSongsByNameFunc(name, n)

Description: Retrieves the top n songs for an artist by their name. Uses getIdByNameFunc and topPopularSongsByIdFunc internally.

Parameters:

  • name (string): The name of the artist.
  • n (number): The number of top songs to retrieve.

Returns: A promise resolving to an array of objects, each containing the song title and album name.

Example:

musicArtistInfo.topPopularSongsByNameFunc("Ariana Grande", 2).then(songs => console.log(songs[0].title));
// Returns: "Song 1"

topPopularSongsByName(name, n)

Description: User-facing function that fetches and logs the top n songs for an artist by their name.

Parameters:

  • name (string): The name of the artist.
  • n (number): The number of top songs to retrieve.

Output: Logs an array of objects containing song titles and album names to the console.

Example:

musicArtistInfo.topPopularSongsByName("Ariana Grande", 3);
// Logs: [{ title: "Song 1", albumName: "Album 1" }, { title: "Song 2", albumName: "Album 2" }, { title: "Song 3", albumName: "Album 3" }]

artistInfoByNameFunc(name)

Description: Retrieves detailed information about an artist by their name. Designed for internal use.

Parameters:

  • name (string): The name of the artist.

Returns: A promise resolving to an object containing the artist's ID, name, number of fans, and number of albums.

Example:

musicArtistInfo.artistInfoByNameFunc("Ariana Grande").then(info => console.log(info.nb_fan));
// Returns: Number of fans (e.g., 12345678)

artistInfoByName(name)

Description: User-facing function that fetches and logs detailed information about an artist by their name.

Parameters:

  • name (string): The name of the artist.

Output: Logs an object containing the artist's ID, name, number of fans, and number of albums to the console.

Example:

musicArtistInfo.artistInfoByName("Ariana Grande");
// Logs: { id: 1562681, name: "Ariana Grande", nb_fan: 12345678, nb_album: 7 }

Example Usage

// Fetch and log artist info
musicArtistInfo.artistInfoByName("Ariana Grande");

// Fetch and log top 3 songs
musicArtistInfo.topPopularSongsByName("Ariana Grande", 3);

// Programmatic use of returned data
musicArtistInfo.topPopularSongsByNameFunc("Ariana Grande", 2).then(songs => {
    console.log(songs[0].title); // Logs the title of the first song
});

Notes

  • The library assumes a stable internet connection to access the Deezer API.
  • Ensure proper error handling in production code, as the Deezer API may return errors for invalid artist names or IDs.
  • The Func versions are ideal for building more complex applications, while the non-Func versions are convenient for quick testing.

Author

This project was created by Viggo ponturo Nygaard.