{"id":17399229,"url":"https://github.com/feross/last-fm","last_synced_at":"2025-04-07T10:28:28.507Z","repository":{"id":48344093,"uuid":"83370550","full_name":"feross/last-fm","owner":"feross","description":"Simple, robust LastFM API client (for public data)","archived":false,"fork":false,"pushed_at":"2021-07-30T23:28:43.000Z","size":47,"stargazers_count":191,"open_issues_count":2,"forks_count":27,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-31T07:05:55.823Z","etag":null,"topics":["javascript","last-fm","lastfm","lastfm-api","music","musicbrainz","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/feross.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-28T00:17:34.000Z","updated_at":"2025-03-08T07:47:46.000Z","dependencies_parsed_at":"2022-09-14T15:30:45.053Z","dependency_job_id":null,"html_url":"https://github.com/feross/last-fm","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feross%2Flast-fm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feross%2Flast-fm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feross%2Flast-fm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feross%2Flast-fm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/feross","download_url":"https://codeload.github.com/feross/last-fm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247634857,"owners_count":20970618,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["javascript","last-fm","lastfm","lastfm-api","music","musicbrainz","nodejs"],"created_at":"2024-10-16T15:13:36.950Z","updated_at":"2025-04-07T10:28:28.483Z","avatar_url":"https://github.com/feross.png","language":"JavaScript","readme":"# last-fm [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url]\n\n[travis-image]: https://img.shields.io/travis/feross/last-fm/master.svg\n[travis-url]: https://travis-ci.org/feross/last-fm\n[npm-image]: https://img.shields.io/npm/v/last-fm.svg\n[npm-url]: https://npmjs.org/package/last-fm\n[downloads-image]: https://img.shields.io/npm/dm/last-fm.svg\n[downloads-url]: https://npmjs.org/package/last-fm\n\n### Simple, robust LastFM API client (for public data)\n\n## Install\n\n```\nnpm install last-fm\n```\n\n## Why this package?\n\nThe most useful data on LastFM is the public music data. When building an app that\nincorporates music data from LastFM, lots of functionality provided by the LastFM\nAPI isn't necessary – authorizing as a user, liking tracks, adding/removing tags,\ngetting a list of songs in the user's \"library\", etc.\n\nThis package only provides the LastFM API methods that use GET requests to fetch\ndata, making it **smaller and simpler** than the other LastFM libraries.\n\nIf this matches your use case, consider using this package.\n\n## Features\n\n  - Powered by the [LastFM API](http://www.last.fm/api)\n  - Lightweight library, only provides the GET methods from the Last.fm API\n\n## Usage\n\nFirst, [get an API key](https://www.last.fm/api/account/create) from Last.fm.\n\n```js\nconst LastFM = require('last-fm')\nconst lastfm = new LastFM('API_KEY', { userAgent: 'MyApp/1.0.0 (http://example.com)' })\n\nlastfm.trackSearch({ q: 'the greatest' }, (err, data) =\u003e {\n  if (err) console.error(err)\n  else console.log(data)\n})\n```\n\n## API\n\n### `lastfm = new LastFM(key, [opts])`\n\nCreate a new LastFM API client with the given public API `key`.\n\nSince all the LastFM calls supported by this module access public data, the secret\nkey is not required.\n\nIf `opts` is provided, it can contain the following options:\n\n- `opts.userAgent` - String to use as the `User-Agent` header in http requests\n- `opts.minArtistListeners` - Exclude artist results with fewer than this number of \"listeners\" (default: `0`)\n- `opts.minTrackListeners` - Exclude track results with fewer than this number of \"listeners\" (default: `0`)\n\nNote: Unfortunately, there is no `opts.minAlbumListeners` since the Last.fm API does not\ninclude listener numbers in album results (even though the data exists when you get an\nindividual album via `lastfm.albumInfo`)\n\n## Convenience API\n\nThese APIs are not part of the LastFM documentation, but they use data from the API\nand process it into a more useful form.\n\n### `lastfm.search(opts, (err, data) =\u003e {})`\n\nSearch for artists, tracks, or albums by name. ([album.search](http://www.last.fm/api/show/album.search), [artist.search](http://www.last.fm/api/show/artist.search), [track.search](http://www.last.fm/api/show/track.search))\n\nThis returns the \"top result\" across all result types, prioritizing an exact query\nmatch, if one exists. Otherwise, the most popular result by number of \"listeners\"\nis used.\n\n- `opts.q` - the search query\n- `opts.limit` - the number of each type of result to fetch\n\n## Album API\n\n### `lastfm.albumInfo(opts, (err, data) =\u003e {})`\n\nGet the metadata and tracklist for an album on Last.fm using the album name. ([album.getInfo](http://www.last.fm/api/show/album.getInfo))\n\n### `lastfm.albumTopTags(opts, (err, data) =\u003e {})`\n\nGet the top tags for an album on Last.fm, ordered by popularity. ([album.getTopTags](http://www.last.fm/api/show/album.getTopTags))\n\n### `lastfm.albumSearch(opts, (err, data) =\u003e {})`\n\nSearch for an album by name. Returns album matches sorted by relevance. ([album.search](http://www.last.fm/api/show/album.search))\n\n## Artist API\n\n### `lastfm.artistCorrection(opts, (err, data) =\u003e {})`\n\nUse the last.fm corrections data to check whether the supplied artist has a correction to a canonical artist. ([artist.getCorrection](http://www.last.fm/api/show/artist.getCorrection))\n\n### `lastfm.artistInfo(opts, (err, data) =\u003e {})`\n\nGet the metadata for an artist. Includes biography, truncated at 300 characters. ([artist.getInfo](http://www.last.fm/api/show/artist.getInfo))\n\n### `lastfm.artistSimilar(opts, (err, data) =\u003e {})`\n\nGet all the artists similar to this artist ([artist.getSimilar](http://www.last.fm/api/show/artist.getSimilar))\n\n### `lastfm.artistTopAlbums(opts, (err, data) =\u003e {})`\n\nGet the top albums for an artist on Last.fm, ordered by popularity. ([artist.getTopAlbums](http://www.last.fm/api/show/artist.getTopAlbums))\n\n### `lastfm.artistTopTags(opts, (err, data) =\u003e {})`\n\nGet the top tags for an artist on Last.fm, ordered by popularity. ([artist.getTopTags](http://www.last.fm/api/show/artist.getTopTags))\n\n### `lastfm.artistTopTracks(opts, (err, data) =\u003e {})`\n\nGet the top tracks by an artist on Last.fm, ordered by popularity. ([artist.getTopTracks](http://www.last.fm/api/show/artist.getTopTracks))\n\n### `lastfm.artistSearch(opts, (err, data) =\u003e {})`\n\nSearch for an artist by name. Returns artist matches sorted by relevance. ([artist.search](http://www.last.fm/api/show/artist.search))\n\n## Chart API\n\n### `lastfm.chartTopArtists(opts, (err, data) =\u003e {})`\n\nGet the top artists chart. ([chart.getTopArtists](http://www.last.fm/api/show/chart.getTopArtists))\n\n### `lastfm.chartTopTags(opts, (err, data) =\u003e {})`\n\nGet the top tags chart. ([chart.getTopTags](http://www.last.fm/api/show/chart.getTopTags))\n\n### `lastfm.chartTopTracks(opts, (err, data) =\u003e {})`\n\nGet the top tracks chart. ([chart.getTopTracks](http://www.last.fm/api/show/chart.getTopTracks))\n\n## Geo API\n\n### `lastfm.geoTopArtists(opts, (err, data) =\u003e {})`\n\nGet the most popular artists on Last.fm by country. ([geo.getTopArtists](http://www.last.fm/api/show/geo.getTopArtists))\n\n### `lastfm.geoTopTracks(opts, (err, data) =\u003e {})`\n\nGet the most popular tracks on Last.fm last week by country. ([geo.getTopTracks](http://www.last.fm/api/show/geo.getTopTracks))\n\n## Tag API\n\n### `lastfm.tagInfo(opts, (err, data) =\u003e {})`\n\nGet the metadata for a tag. ([tag.getInfo](http://www.last.fm/api/show/tag.getInfo))\n\n### `lastfm.tagSimilar(opts, (err, data) =\u003e {})`\n\nSearch for tags similar to this one. Returns tags ranked by similarity, based on listening data. ([tag.getSimilar](http://www.last.fm/api/show/tag.getSimilar))\n\n### `lastfm.tagTopAlbums(opts, (err, data) =\u003e {})`\n\nGet the top albums tagged by this tag, ordered by tag count. ([tag.getTopAlbums](http://www.last.fm/api/show/tag.getTopAlbums))\n\n### `lastfm.tagTopArtists(opts, (err, data) =\u003e {})`\n\nGet the top artists tagged by this tag, ordered by tag count. ([tag.getTopArtists](http://www.last.fm/api/show/tag.getTopArtists))\n\n### `lastfm.tagTopTags(opts, (err, data) =\u003e {})`\n\nFetches the top global tags on Last.fm, sorted by popularity (number of times used). ([tag.getTopTags](http://www.last.fm/api/show/tag.getTopTags))\n\n### `lastfm.tagTopTracks(opts, (err, data) =\u003e {})`\n\nGet the top tracks tagged by this tag, ordered by tag count. ([tag.getTopTracks](http://www.last.fm/api/show/tag.getTopTracks))\n\n## Track API\n\n### `lastfm.trackCorrection(opts, (err, data) =\u003e {})`\n\nUse the last.fm corrections data to check whether the supplied track has a correction to a canonical track. ([track.getCorrection](http://www.last.fm/api/show/track.getCorrection))\n\n### `lastfm.trackInfo(opts, (err, data) =\u003e {})`\n\nGet the metadata for a track on Last.fm using the artist/track name. ([track.getInfo](http://www.last.fm/api/show/track.getInfo))\n\n### `lastfm.trackSimilar(opts, (err, data) =\u003e {})`\n\nGet the similar tracks for this track on Last.fm, based on listening data. ([track.getSimilar](http://www.last.fm/api/show/track.getSimilar))\n\n### `lastfm.trackTopTags(opts, (err, data) =\u003e {})`\n\nGet the top tags for this track on Last.fm, ordered by tag count. Supply a track \u0026 artist name. ([track.getTopTags](http://www.last.fm/api/show/track.getTopTags))\n\n### `lastfm.trackSearch(opts, (err, data) =\u003e {})`\n\nSearch for a track by track name. Returns track matches sorted by relevance. ([track.search](http://www.last.fm/api/show/track.search))\n\n## License\n\nMIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeross%2Flast-fm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffeross%2Flast-fm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeross%2Flast-fm/lists"}