npm i lastfm-api-node
const { getUserInfo } = require("lastfm-api-node")
return getUserInfo(username, api_key)
.then((response) => {
console.log(response)
})
.catch((error) => {
console.log(error)
})
Retrieves the count of artists in the user's library.
Usage:
getArtistCount("username", true)
getArtistCount("username", false)
username
string The username of the user whose artist count is being retrieved.cors
boolean Whether to use a CORS proxy to bypass CORS restrictions.
Returns Promise A promise that resolves with the number of artists in the user's library.
Fetches information about a user, such as their username and email.
Usage:
getUserInfo("username", "api_key")
username
string The username of the user whose information is being fetchedapi_key
string The API key for the service.
Returns Promise A promise that resolves with an object containing the user's information.
Retrieves all cookies related to the current session.
Usage:
getCookies("nextjs")
type
string The type of cookie you want to use for the service.
Returns Promise A promise that resolves with an object containing all cookies.
Sets cookies for the user session. Currently supports only Next.js applications.
Usage:
setCookies("nextjs", "session_key", "username");
type
string The type of application, e.g., "nextjs".session_key
string The session key to be stored in the cookie.username
string The username to be stored in the cookie.
Returns string A confirmation message or an error message if the type is not supported.
Fetches the session for a user based on the provided token, signature, and API key.
Usage:
getSession("token", "signature", "api_key")
token
string The token for the session.signature
string The signature for the session.api_key
string The API key for the service.
Returns Promise A promise that resolves with the session data or rejects with an error.
Retrieves the user's recent tracks from the service.
Usage:
getRecentTracks("username", "api_key")
username
string The username whose recent tracks are to be fetched.api_key
string The API key for the service.
Returns Promise A promise that resolves with the recent tracks data or rejects with an error.