{"id":24374173,"url":"https://github.com/mannuelf/lastfm-nodejs-client","last_synced_at":"2026-04-02T14:52:32.127Z","repository":{"id":62309398,"uuid":"558696387","full_name":"mannuelf/lastfm-nodejs-client","owner":"mannuelf","description":"A Node JS client for interacting with the LastFm API","archived":false,"fork":false,"pushed_at":"2026-03-27T06:31:22.000Z","size":583,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-27T17:47:06.872Z","etag":null,"topics":["api","api-client","lastfm","nodejs","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/lastfm-nodejs-client","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mannuelf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-10-28T04:51:17.000Z","updated_at":"2026-03-27T06:24:22.000Z","dependencies_parsed_at":"2023-02-12T20:45:46.455Z","dependency_job_id":"fa1fe10d-2880-44b3-98e3-f3f6bbafce31","html_url":"https://github.com/mannuelf/lastfm-nodejs-client","commit_stats":{"total_commits":98,"total_committers":2,"mean_commits":49.0,"dds":0.08163265306122447,"last_synced_commit":"511f814cd488d6e37b34363650716709946f8ffd"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/mannuelf/lastfm-nodejs-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mannuelf%2Flastfm-nodejs-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mannuelf%2Flastfm-nodejs-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mannuelf%2Flastfm-nodejs-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mannuelf%2Flastfm-nodejs-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mannuelf","download_url":"https://codeload.github.com/mannuelf/lastfm-nodejs-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mannuelf%2Flastfm-nodejs-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31308447,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-client","lastfm","nodejs","typescript"],"created_at":"2025-01-19T05:26:46.129Z","updated_at":"2026-04-02T14:52:32.119Z","avatar_url":"https://github.com/mannuelf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LastFm NodeJs client\n\n[![NPM Version](https://img.shields.io/npm/v/lastfm-nodejs-client.svg?branch=main)](https://www.npmjs.com/package/lastfm-nodejs-client)\n[![Downloads Per Week](https://img.shields.io/npm/dw/lastfm-nodejs-client.svg?color=blue)](https://www.npmjs.com/package/lastfm-nodejs-client)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/ba3b73c24e06433fabe0efed8b43d026)](https://www.codacy.com/gh/mannuelf/lastfm-nodejs-client/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=mannuelf/lastfm-nodejs-client\u0026utm_campaign=Badge_Grade)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nA TypeScript client for the [Last.fm API](https://www.last.fm/api). Works in Node.js ≥18 and all modern browsers — no polyfills required.\n\n## Why use this\n\n**Zero dependencies.** The library ships no third-party runtime dependencies. HTTP requests use the native `fetch` API built into Node.js ≥18, and API signatures are generated with the built-in `node:crypto` module. Installing it won't bloat your `node_modules` or introduce supply-chain risk.\n\n**Fully typed.** Every API response has a hand-written TypeScript interface, so you get autocomplete and type safety straight out of the box — no extra `@types` packages needed.\n\n**Dual ESM + CJS.** The package ships both ES module and CommonJS builds, so it works in any Node.js project regardless of whether you use `import` or `require`.\n\n## Install\n\n```bash\npnpm add lastfm-nodejs-client\n```\n\n```bash\nnpm install lastfm-nodejs-client\n```\n\n```bash\nyarn add lastfm-nodejs-client\n```\n\n```bash\nbun add lastfm-nodejs-client\n```\n\n```ts\n// Deno\nimport LastFmApi from 'jsr:@mannuelf/lastfm-nodejs-client';\n```\n\n## Setup\n\nCreate a `.env` file in your project root:\n\n```bash\nLASTFM_API_BASE_URL=\"https://ws.audioscrobbler.com/2.0/\"\nLASTFM_USER=\"your_username\"\nLASTFM_API_KEY=\"your_api_key\"\nLASTFM_APPNAME=\"your_app_name\"\nLASTFM_SHARED_SECRET=\"your_shared_secret\"\n```\n\nGet your API key at [last.fm/api/account/create](https://www.last.fm/api/account/create).\n\n## Usage\n\n```ts\nimport LastFmApi from 'lastfm-nodejs-client';\n\nconst lastFm = LastFmApi();\nconst { method } = lastFm;\n```\n\n### Get a user's top artists\n\n```ts\nimport LastFmApi from 'lastfm-nodejs-client';\nimport type { TopArtistsResponse } from 'lastfm-nodejs-client';\n\nconst lastFm = LastFmApi();\nconst { method } = lastFm;\n\nconst data: TopArtistsResponse = await lastFm.getTopArtists(\n  method.user.getTopArtists,\n  'your_username',\n  'overall', // period: overall | 7day | 1month | 3month | 6month | 12month\n  '10', // limit\n);\n\nconsole.log(data.topartists.artist);\n```\n\n### Get a user's recent tracks\n\n```ts\nimport LastFmApi from 'lastfm-nodejs-client';\nimport type { RecentTracksResponse } from 'lastfm-nodejs-client';\n\nconst lastFm = LastFmApi();\nconst { method } = lastFm;\n\nconst data: RecentTracksResponse = await lastFm.getRecentTracks(\n  method.user.getRecentTracks,\n  'your_username',\n  '10', // limit\n);\n\nconsole.log(data.recenttracks.track);\n```\n\n### Get artist info\n\n```ts\nimport LastFmApi from 'lastfm-nodejs-client';\nimport type { ArtistInfoResponse } from 'lastfm-nodejs-client';\n\nconst lastFm = LastFmApi();\nconst { method } = lastFm;\n\nconst data: ArtistInfoResponse = await lastFm.artist.artistGetInfo(\n  method.artist.getInfo,\n  'Radiohead',\n);\n\nconsole.log(data.artist);\n```\n\n### Get album info\n\n```ts\nimport LastFmApi from 'lastfm-nodejs-client';\nimport type { AlbumInfoResponse } from 'lastfm-nodejs-client';\n\nconst lastFm = LastFmApi();\nconst { method } = lastFm;\n\nconst data: AlbumInfoResponse = await lastFm.album.albumGetInfo(\n  method.album.getInfo,\n  'Radiohead',\n  'OK Computer',\n);\n\nconsole.log(data.album);\n```\n\n### Search for a track\n\n```ts\nimport LastFmApi from 'lastfm-nodejs-client';\nimport type { TrackSearchResponse } from 'lastfm-nodejs-client';\n\nconst lastFm = LastFmApi();\nconst { method } = lastFm;\n\nconst data: TrackSearchResponse = await lastFm.track.trackSearch(\n  method.track.search,\n  'Creep',\n  'Radiohead', // optional artist filter\n  '5', // limit\n);\n\nconsole.log(data.results.trackmatches.track);\n```\n\n### Love a track (authenticated)\n\nRequires a session key (`sk`) obtained via `auth.getMobileSession` or `auth.getSession`.\n\n```ts\nimport LastFmApi from 'lastfm-nodejs-client';\n\nconst lastFm = LastFmApi();\nconst { method } = lastFm;\n\nawait lastFm.track.trackLove(method.track.love, 'Radiohead', 'Creep', 'your_session_key');\n```\n\n## All available namespaces\n\n| Namespace | Methods                                                                                                                                                                                                           |\n| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `album`   | `albumGetInfo`, `albumGetTags`, `albumGetTopTags`, `albumSearch`, `albumAddTags`, `albumRemoveTag`                                                                                                                |\n| `artist`  | `artistGetInfo`, `artistGetSimilar`, `artistGetTags`, `artistGetTopAlbums`, `artistGetTopTags`, `artistGetTopTracks`, `artistSearch`, `artistAddTags`, `artistRemoveTag`, `artistGetCorrection`                   |\n| `auth`    | `getToken`, `getSession`, `getMobileSession`                                                                                                                                                                      |\n| `chart`   | `chartTopArtists`, `chartTopTracks`, `chartTopTags`                                                                                                                                                               |\n| `geo`     | `geoGetTopArtists`, `geoGetTopTracks`                                                                                                                                                                             |\n| `library` | `libraryGetArtists`                                                                                                                                                                                               |\n| `tag`     | `tagGetInfo`, `tagGetSimilar`, `tagGetTopAlbums`, `tagGetTopArtists`, `tagGetTopTags`, `tagGetWeeklyChartList`, `tagTopTracks`                                                                                    |\n| `track`   | `trackGetInfo`, `trackGetSimilar`, `trackGetTags`, `trackGetTopTags`, `trackSearch`, `trackLove`, `trackUnlove`, `trackAddTags`, `trackRemoveTag`, `trackScrobble`, `trackUpdateNowPlaying`, `trackGetCorrection` |\n| `user`    | `userGetPersonalTags`                                                                                                                                                                                             |\n\nLegacy flat methods also available: `getTopArtists`, `getTopTracks`, `getRecentTracks`, `getLovedTracks`, `getInfo`, `getFriends`, `getUserTopTags`, `getWeeklyAlbumChart`, `getWeeklyArtistChart`, `getWeeklyChartList`, `getWeeklyTrackChart`, `getTopAlbums`.\n\n## Developing\n\n```bash\ngh repo fork mannuelf/lastfm-nodejs-client\n```\n\n```bash\npnpm install\npnpm test\npnpm lint\npnpm build\n```\n\n### Why I built this\n\nI was building a scrobbles page at [mannuelferreira.com/scrobbles](https://mannuelferreira.com/scrobbles) and thought others might find it useful.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmannuelf%2Flastfm-nodejs-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmannuelf%2Flastfm-nodejs-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmannuelf%2Flastfm-nodejs-client/lists"}