Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solely/simple-fm

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solely/simple-fm

A simple, asynchronous Last.fm wrapper in TypeScript.

  • 1.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
74
increased by155.17%
Maintainers
1
Weekly downloads
 
Created
Source

simple-fm

CI npm-image downloads-image license-image

simple-fm is a simple, asynchronous Last.fm wrapper in TypeScript.

Search for what someone has been listening to lately, what tracks are trending in a country, an artist's top tracks, and a lot more.

Install

Node.js 16+ is recommended for this package.

  • npm: npm i @solely/simple-fm
  • pnpm: pnpm i @solely/simple-fm
  • yarn: yarn add @solely/simple-fm

Notice

simple-fm requires you to have a Last.fm API token.

To obtain a Last.fm API token, click here to register an API account.

Usage

// Import the simple-fm package.
import client from '@solely/simple-fm';

// Replace the token with your Last.fm token.
const lastFM = new client('last.fm token');

// Fetch the recent track from a user.
const json = await lastFM.user.fetchRecentTrack('solelychloe');

console.log(json);
// => { currentlyPlaying: true, name: 'Dark World', artist: 'Mikel', album: 'Zelda & Chill', ...}

If you're using Deno, import simple-fm from a URL. For example, via a CDN:

import client from 'https://esm.sh/@solely/simple-fm';

Documentation

album

album.fetch(artistName, albumName, userName?)

Fetches and returns metadata information for an album.

  • artistName: The name of the artist.
  • albumName: The name of the album.
  • userName?: The username for the context of the request. If supplied, the user's playcount for this artist's album is included in the response.

album.fetchTopTags(artistName, albumName)

Fetches and returns popular tags for an album.

  • artistName: The name of the artist.
  • albumName: The name of the album.

album.search(albumName, limit?, page?)

Search for an album by name.

  • albumName: The name of the album.
  • limit?: The number of results to fetch per page. Defaults to 30.
  • page?: The page number to fetch. Defaults to the first page.

artist

artist.fetch(artistName, userName?)

Fetches and returns metadata information for an artist.

  • artistName: The artist's name.
  • userName?: The username for the context of the request. If supplied, the user's playcount for this artist is included in the response.

artist.fetchSimilar(artistName, limit?)

Fetches and returns similar artists to this artist.

  • artistName: The artist's name.
  • limit?: The number of results to fetch per page. Defaults to 30.

artist.fetchTopAlbums(artistName, limit?, page?)

Fetches and returns popular albums for an artist.

  • artistName: The artist's name.
  • limit?: The number of results to fetch per page. Defaults to 50.
  • page?: The page number to fetch. Defaults to the first page.

artist.fetchTopTags(artistName)

Fetches and returns popular tags for an artist.

  • artistName: The artist's name.

artist.fetchTopTracks(artistName, limit?, page?)

Fetches and returns popular tracks for an artist.

  • artistName: The artist's name.
  • limit?: The number of results to fetch per page. Defaults to 50.
  • page?: The page number to fetch. Defaults to the first page.

artist.search(artistName, limit?, page?)

Search for an artist by name.

  • artistName: The artist's name.
  • limit?: The number of results to fetch per page. Defaults to 30.
  • page?: The page number to fetch. Defaults to the first page.

chart

chart.fetchTopArtists(limit?, page?)

Fetches and returns the most popular artists.

  • limit?: The number of results to fetch per page. Defaults to 30.
  • page?: The page number to fetch. Defaults to the first page.

chart.fetchTopTags(limit?, page?)

Fetches and returns the most popular tags for tracks.

  • limit?: The number of results to fetch per page. Defaults to 30.
  • page?: The page number to fetch. Defaults to the first page.

chart.fetchTopTracks(limit?, page?)

Fetches and returns the most popular tracks.

  • limit?: The number of results to fetch per page. Defaults to 30.
  • page?: The page number to fetch. Defaults to the first page.

geo

geo.fetchTopArtists(country, limit?, page?)

Fetches and returns the most popular artists by country.

Ordered by relevance.

  • country: The name of the country.
  • limit?: The number of results to fetch per page. Defaults to 50.
  • page?: The page number to fetch. Defaults to the first page.

geo.fetchTopTracks(country, limit?, page?)

Fetches and returns the most popular tracks by country.

Ordered by relevance.

  • country: The name of the country.
  • limit?: The number of results to fetch per page. Defaults to 50.
  • page?: The page number to fetch. Defaults to the first page.

tag

tag.fetch(tagName)

Fetches and returns metadata information on a tag.

  • tagName: The name of the tag.

tag.fetchTopAlbums(tagName, limit?, page?)

  • tagName: The name of the tag.
  • limit?: The number of results to fetch per page. Defaults to 50.
  • page?: The page number to fetch. Defaults to the first page.

tag.fetchTopArtists(tagName, limit?, page?)

  • tagName: The name of the tag.
  • limit?: The number of results to fetch per page. Defaults to 50.
  • page?: The page number to fetch. Defaults to the first page.

tag.fetchTopTags()

Fetches and returns popular albums that are tagged by a tag name.

tag.fetchTopTracks(tagName, limit?, page?)

Fetches and returns popular tracks for a tag.

  • tagName: The name of the tag.
  • limit?: The number of results to fetch per page. Defaults to 50.
  • page?: The page number to fetch. Defaults to the first page.

tag.fetchWeeklyChartList(tagName)

Fetches and returns a list of available charts for a tag.

  • tagName: The name of the tag.

track

track.fetch(artistName, trackName, userName?)

Fetches and returns metadata information for a track.

  • artistName: The name of the artist.
  • trackName: The name of the track.

track.fetchSimilar(artistName, trackName, limit?)

Fetches and returns similar tracks for this track.

  • artistName: The name of the artist.
  • trackName: The name of the track.
  • limit?: The number of results to fetch per page. Defaults to 30.

track.fetchTopTags(artistName, trackName)

Fetches and returns popular tags for a track.

  • artistName: The name of the artist.
  • trackName: The name of the track.

track.search(trackName, limit?, page?)

Search for a track by name.

  • trackName: The name of the track.
  • limit?: The number of results to fetch per page. Defaults to 30.
  • page?: The page number to fetch. Defaults to the first page.

user

user.fetch(userName)

Fetches and returns information about a user's profile.

  • userName: The name of the user.

user.fetchAllArtists(userName, limit?, page?)

Fetches and returns a list of all the artists in a user's library.

  • userName: The name of the user.
  • limit?: The number of results to fetch per page. Defaults to 50.
  • page?: The page number to fetch. Defaults to the first page.

user.fetchFriends(userName, limit?, page?)

Fetches and returns a list of the user's friends.

  • userName: The name of the user.
  • limit?: The number of results to fetch per page. Defaults to 50.
  • page?: The page number to fetch. Defaults to the first page.

user.fetchLovedTracks(userName, limit?, page?)

Fetches and returns the loved tracks as set by the user.

  • userName: The name of the user.
  • limit?: The number of results to fetch per page. Defaults to 50.
  • page?: The page number to fetch. Defaults to the first page.

user.fetchPersonalTags(userName, tagName, tagType)

Fetches and returns a list of the user's personal tags.

  • userName: The name of the user.
  • tagName: The name of the tag.
  • tagType: The type of items which have been tagged. Accepted options: album, artist, track

user.fetchRecentTracks(userName, limit?, page?)

Fetches and returns the most recent track listened by the user.

  • userName: The name of the user.
  • limit?: The number of results to fetch per page. Defaults to 50. Maximum is 200.
  • page?: The page number to fetch. Defaults to the first page.

user.fetchTopAlbums

Fetches and returns a list of popular albums in a user's library.

  • userName: The name of the user.
  • limit?: The number of results to fetch per page. Defaults to 50.
  • page?: The page number to fetch. Defaults to the first page.

user.fetchTopTags(userName, limit?)

  • userName: The name of the user.
  • limit?: The number of results to fetch per page. Defaults to 50.

user.fetchTopTracks(userName, limit?, page?)

Fetches and returns a list of popular tracks in a user's library.

  • userName: The name of the user.
  • limit?: The number of results to fetch per page. Defaults to 50.
  • page?: The page number to fetch. Defaults to the first page.

License

This package is licensed under the zlib license.

© 2023 Chloe Arciniega.

Keywords

FAQs

Package last updated on 03 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc