Skip to content

39Choko/lastfm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@39choko/lastfm

About

@39choko/lastfm is a NodeJS module that allows you to interacting with the LastFM API.

Installation

npm install @39choko/lastfm
yarn add @39choko/lastfm
pnpm add @39choko/lastfm
bun add @39choko/lastfm
deno install npm:@39choko/lastfm

Example usage

First, you need to obtain an API key from Last.fm. You can get one here: https://www.last.fm/api/account/create

const { Client } = require('@39choko/lastfm');

const lastfm = new Client(
  apiKey: 'YOUR_API_KEY', {
    /* Optional Parameters: */
    apiSecret: 'YOUR_API_SECRET', // Required for some methods like authentication
    appName: 'YourAppName' // Optional, but it's recommended
  }
);

await lastfm.login() // If you want to login into lastFM <- Need apiSecret

Example

Getting Artist Info

await lastfm.artist.getInfo({ artist: "Cher" }).then(console.log);

// Or

const artistGetInfo = await lastfm.artist.getInfo({ artist: "Cher" });
console.log(artistGetInfo);

Searching for a Track

await lastfm.track.search({ track: "Believe" }).then(console.log);

// Or

const trackSearch = await lastfm.track.search({ track: "Believe" }).then(console.log);
console.log(trackSearch);

Adding a Tag to an Album

// You need to be logged in first

await lastfm.login();
await lastfm.album.addTags({ album: "ECHO", artist: "Crusher-P", tags: ["favorites", "study"] }); // return undefined

Links

About

A simple Last.fm API client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published