homura-js

1.4.2 • Public • Published

An API Wrapper for LastFM API

A series of tools to facilitate interaction with the LastFM API. It uses YOUR API KEY as a form of authentication.

Installation

Via NPM:

$ npm install homura-js

Features:

Album

  • getInfo(): Get the metadata and tracklist for an album on Last.fm using the album name.
  • getTags(): Get the tags applied by an individual user to an album on Last.fm.
  • getTopTags(): Get the top tags for an album on Last.fm, ordered by popularity.
  • search(): Search for an album by name. Returns album matches sorted by relevance.

Artist

  • getInfo(): Get the metadata for an artist.
  • getSimilar(): Get all the artists similar to this artist.
  • getTags(): Get the tags applied by an individual user to an artist on Last.fm.
  • getTopTags(): Get the top tags for an album on Last.fm, ordered by popularity.
  • getTopAlbum(): Get the top albums for an artist on Last.fm, ordered by popularity.
  • getTopTracks(): Get the top tracks by an artist on Last.fm, ordered by popularity.
  • search(): Search for an artist by name. Returns artist matches sorted by relevance.

Users

  • getFriends(): Get a list of the user's friends on Last.fm.
  • getInfo(): Get information about a user profile.
  • getLovedTracks(): Get the last 50 tracks loved by a user.
  • getRecentTracks(): Get a list of the recent tracks listened to by this user.
  • getTopAlbums(): Get the top albums listened to by a user. You can stipulate a time period.
  • getTopTracks(): Get the top tracks listened to by a user. You can stipulate a time period.

Geo

  • getTopArtists(): Get the most popular artists on Last.fm by country.
  • getTopTracks(): Get the most popular tracks on Last.fm last week by country

Track

  • search(): Search for a track by track name. Returns track matches sorted by relevance.
  • getInfo(): Get the metadata for a track on Last.fm using the artist/track name or a musicbrainz id.
  • getSimilar(): Get the similar tracks for this track on Last.fm, based on listening data.

Library

  • getArtists(): A paginated list of all the artists in a user's library, with play counts and tag counts.

Example

import Homura from 'homura-js';

const Wrapper = new Homura("YOUR API KEY");
let result = await Wrapper.artist.getTopTracks("Clairo", 5)
result.toptracks.track.forEach(track => {console.log(track.name)})

👉 Output: 
    - Sofia
    - Pretty Girl
    - Bags
    - Flaming Hot Cheetos
    - Harbor

Running Tests

You can test the Wrapper by running this command:

# Before running the tests, check that they have YOUR API KEY.

$ npm run test

Security

If you discover any security related issues, please send me a message on Discord - Seiku#0666.

License

The MIT License (MIT). Please see LICENSE for more information.

Stay Positive

Readme

Keywords

Package Sidebar

Install

npm i homura-js

Weekly Downloads

7

Version

1.4.2

License

MIT

Unpacked Size

28 kB

Total Files

20

Last publish

Collaborators

  • vergonha