lastfm-nodejs-client 1.5.6 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +140 -74
- package/dist/@types/album/addTags.d.ts +11 -0
- package/dist/@types/album/getInfo.d.ts +11 -0
- package/dist/@types/album/getTags.d.ts +11 -0
- package/dist/@types/album/getTopTags.d.ts +10 -0
- package/dist/@types/album/removeTag.d.ts +11 -0
- package/dist/@types/album/search.d.ts +10 -0
- package/dist/@types/artist/addTags.d.ts +10 -0
- package/dist/@types/artist/getCorrection.d.ts +9 -0
- package/dist/@types/artist/getInfo.d.ts +10 -0
- package/dist/@types/artist/getSimilar.d.ts +10 -0
- package/dist/@types/artist/getTags.d.ts +10 -0
- package/dist/@types/artist/getTopAlbums.d.ts +11 -0
- package/dist/@types/artist/getTopTags.d.ts +9 -0
- package/dist/@types/artist/getTopTracks.d.ts +11 -0
- package/dist/@types/artist/removeTag.d.ts +10 -0
- package/dist/@types/artist/search.d.ts +10 -0
- package/dist/@types/auth/getMobileSession.d.ts +11 -0
- package/dist/@types/auth/getSession.d.ts +10 -0
- package/dist/@types/auth.d.ts +9 -6
- package/dist/@types/chart/topArtists.d.ts +11 -0
- package/dist/@types/chart/topTags.d.ts +8 -0
- package/dist/@types/chart/topTracks.d.ts +8 -0
- package/dist/@types/config.d.ts +13 -11
- package/dist/@types/createOptions.d.ts +23 -0
- package/dist/@types/geo/getTopArtists.d.ts +10 -0
- package/dist/@types/geo/getTopTracks.d.ts +10 -0
- package/dist/@types/getFriends.d.ts +6 -3
- package/dist/@types/getInfo.d.ts +5 -3
- package/dist/@types/getLovedTracks.d.ts +7 -3
- package/dist/@types/getRecentTracks.d.ts +7 -3
- package/dist/@types/getTopAlbums.d.ts +7 -3
- package/dist/@types/getTopArtists.d.ts +7 -3
- package/dist/@types/getTopTracks.d.ts +7 -3
- package/dist/@types/getUserTopTags.d.ts +6 -3
- package/dist/@types/getWeeklyAlbumChart.d.ts +7 -3
- package/dist/@types/getWeeklyArtistChart.d.ts +7 -3
- package/dist/@types/getWeeklyChartList.d.ts +8 -3
- package/dist/@types/getWeeklyTrackChart.d.ts +7 -3
- package/dist/@types/index.d.ts +31 -89
- package/dist/@types/lastfm.types.d.ts +1 -2
- package/dist/@types/library/getArtists.d.ts +10 -0
- package/dist/@types/md5.d.ts +7 -0
- package/dist/@types/method.d.ts +25 -77
- package/dist/@types/request.d.ts +23 -0
- package/dist/@types/tag/getInfo.d.ts +9 -0
- package/dist/@types/tag/getSimilar.d.ts +8 -0
- package/dist/@types/tag/getTopAlbums.d.ts +10 -0
- package/dist/@types/tag/getTopArtists.d.ts +10 -0
- package/dist/@types/tag/getTopTags.d.ts +7 -0
- package/dist/@types/tag/getWeeklyChartList.d.ts +9 -0
- package/dist/@types/tag/topTracks.d.ts +6 -3
- package/dist/@types/track/addTags.d.ts +11 -0
- package/dist/@types/track/getCorrection.d.ts +10 -0
- package/dist/@types/track/getInfo.d.ts +11 -0
- package/dist/@types/track/getSimilar.d.ts +11 -0
- package/dist/@types/track/getTags.d.ts +11 -0
- package/dist/@types/track/getTopTags.d.ts +10 -0
- package/dist/@types/track/love.d.ts +10 -0
- package/dist/@types/track/removeTag.d.ts +11 -0
- package/dist/@types/track/scrobble.d.ts +12 -0
- package/dist/@types/track/search.d.ts +11 -0
- package/dist/@types/track/unlove.d.ts +10 -0
- package/dist/@types/track/updateNowPlaying.d.ts +11 -0
- package/dist/@types/user/getPersonalTags.d.ts +12 -0
- package/dist/album/addTags.js +11 -0
- package/dist/album/addTags.js.map +1 -1
- package/dist/album/getInfo.js +11 -0
- package/dist/album/getInfo.js.map +1 -1
- package/dist/album/getTags.js +11 -0
- package/dist/album/getTags.js.map +1 -1
- package/dist/album/getTopTags.js +10 -0
- package/dist/album/getTopTags.js.map +1 -1
- package/dist/album/removeTag.js +11 -0
- package/dist/album/removeTag.js.map +1 -1
- package/dist/album/search.js +10 -0
- package/dist/album/search.js.map +1 -1
- package/dist/artist/addTags.js +10 -0
- package/dist/artist/addTags.js.map +1 -1
- package/dist/artist/getCorrection.js +9 -0
- package/dist/artist/getCorrection.js.map +1 -1
- package/dist/artist/getInfo.js +10 -0
- package/dist/artist/getInfo.js.map +1 -1
- package/dist/artist/getSimilar.js +10 -0
- package/dist/artist/getSimilar.js.map +1 -1
- package/dist/artist/getTags.js +10 -0
- package/dist/artist/getTags.js.map +1 -1
- package/dist/artist/getTopAlbums.js +11 -0
- package/dist/artist/getTopAlbums.js.map +1 -1
- package/dist/artist/getTopTags.js +9 -0
- package/dist/artist/getTopTags.js.map +1 -1
- package/dist/artist/getTopTracks.js +11 -0
- package/dist/artist/getTopTracks.js.map +1 -1
- package/dist/artist/removeTag.js +10 -0
- package/dist/artist/removeTag.js.map +1 -1
- package/dist/artist/search.js +10 -0
- package/dist/artist/search.js.map +1 -1
- package/dist/auth/getMobileSession.js +11 -0
- package/dist/auth/getMobileSession.js.map +1 -1
- package/dist/auth/getSession.js +10 -0
- package/dist/auth/getSession.js.map +1 -1
- package/dist/auth.js +9 -6
- package/dist/auth.js.map +1 -1
- package/dist/chart/topArtists.js +11 -0
- package/dist/chart/topArtists.js.map +1 -1
- package/dist/chart/topTags.js +8 -0
- package/dist/chart/topTags.js.map +1 -1
- package/dist/chart/topTracks.js +8 -0
- package/dist/chart/topTracks.js.map +1 -1
- package/dist/cjs/album/addTags.js +11 -0
- package/dist/cjs/album/addTags.js.map +1 -1
- package/dist/cjs/album/getInfo.js +11 -0
- package/dist/cjs/album/getInfo.js.map +1 -1
- package/dist/cjs/album/getTags.js +11 -0
- package/dist/cjs/album/getTags.js.map +1 -1
- package/dist/cjs/album/getTopTags.js +10 -0
- package/dist/cjs/album/getTopTags.js.map +1 -1
- package/dist/cjs/album/removeTag.js +11 -0
- package/dist/cjs/album/removeTag.js.map +1 -1
- package/dist/cjs/album/search.js +10 -0
- package/dist/cjs/album/search.js.map +1 -1
- package/dist/cjs/artist/addTags.js +10 -0
- package/dist/cjs/artist/addTags.js.map +1 -1
- package/dist/cjs/artist/getCorrection.js +9 -0
- package/dist/cjs/artist/getCorrection.js.map +1 -1
- package/dist/cjs/artist/getInfo.js +10 -0
- package/dist/cjs/artist/getInfo.js.map +1 -1
- package/dist/cjs/artist/getSimilar.js +10 -0
- package/dist/cjs/artist/getSimilar.js.map +1 -1
- package/dist/cjs/artist/getTags.js +10 -0
- package/dist/cjs/artist/getTags.js.map +1 -1
- package/dist/cjs/artist/getTopAlbums.js +11 -0
- package/dist/cjs/artist/getTopAlbums.js.map +1 -1
- package/dist/cjs/artist/getTopTags.js +9 -0
- package/dist/cjs/artist/getTopTags.js.map +1 -1
- package/dist/cjs/artist/getTopTracks.js +11 -0
- package/dist/cjs/artist/getTopTracks.js.map +1 -1
- package/dist/cjs/artist/removeTag.js +10 -0
- package/dist/cjs/artist/removeTag.js.map +1 -1
- package/dist/cjs/artist/search.js +10 -0
- package/dist/cjs/artist/search.js.map +1 -1
- package/dist/cjs/auth/getMobileSession.js +11 -0
- package/dist/cjs/auth/getMobileSession.js.map +1 -1
- package/dist/cjs/auth/getSession.js +10 -0
- package/dist/cjs/auth/getSession.js.map +1 -1
- package/dist/cjs/auth.js +9 -6
- package/dist/cjs/auth.js.map +1 -1
- package/dist/cjs/chart/topArtists.js +11 -0
- package/dist/cjs/chart/topArtists.js.map +1 -1
- package/dist/cjs/chart/topTags.js +8 -0
- package/dist/cjs/chart/topTags.js.map +1 -1
- package/dist/cjs/chart/topTracks.js +8 -0
- package/dist/cjs/chart/topTracks.js.map +1 -1
- package/dist/cjs/config.js.map +1 -1
- package/dist/cjs/createOptions.js +23 -0
- package/dist/cjs/createOptions.js.map +1 -1
- package/dist/cjs/geo/getTopArtists.js +10 -0
- package/dist/cjs/geo/getTopArtists.js.map +1 -1
- package/dist/cjs/geo/getTopTracks.js +10 -0
- package/dist/cjs/geo/getTopTracks.js.map +1 -1
- package/dist/cjs/getFriends.js +6 -3
- package/dist/cjs/getFriends.js.map +1 -1
- package/dist/cjs/getInfo.js +5 -3
- package/dist/cjs/getInfo.js.map +1 -1
- package/dist/cjs/getLovedTracks.js +7 -3
- package/dist/cjs/getLovedTracks.js.map +1 -1
- package/dist/cjs/getRecentTracks.js +7 -3
- package/dist/cjs/getRecentTracks.js.map +1 -1
- package/dist/cjs/getTopAlbums.js +7 -3
- package/dist/cjs/getTopAlbums.js.map +1 -1
- package/dist/cjs/getTopArtists.js +7 -3
- package/dist/cjs/getTopArtists.js.map +1 -1
- package/dist/cjs/getTopTracks.js +7 -3
- package/dist/cjs/getTopTracks.js.map +1 -1
- package/dist/cjs/getUserTopTags.js +6 -3
- package/dist/cjs/getUserTopTags.js.map +1 -1
- package/dist/cjs/getWeeklyAlbumChart.js +7 -3
- package/dist/cjs/getWeeklyAlbumChart.js.map +1 -1
- package/dist/cjs/getWeeklyArtistChart.js +7 -3
- package/dist/cjs/getWeeklyArtistChart.js.map +1 -1
- package/dist/cjs/getWeeklyChartList.js +8 -3
- package/dist/cjs/getWeeklyChartList.js.map +1 -1
- package/dist/cjs/getWeeklyTrackChart.js +7 -3
- package/dist/cjs/getWeeklyTrackChart.js.map +1 -1
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/library/getArtists.js +10 -0
- package/dist/cjs/library/getArtists.js.map +1 -1
- package/dist/cjs/md5.js +80 -0
- package/dist/cjs/md5.js.map +1 -0
- package/dist/cjs/method.js +11 -0
- package/dist/cjs/method.js.map +1 -1
- package/dist/cjs/request.js +32 -2
- package/dist/cjs/request.js.map +1 -1
- package/dist/cjs/tag/getInfo.js +9 -0
- package/dist/cjs/tag/getInfo.js.map +1 -1
- package/dist/cjs/tag/getSimilar.js +8 -0
- package/dist/cjs/tag/getSimilar.js.map +1 -1
- package/dist/cjs/tag/getTopAlbums.js +10 -0
- package/dist/cjs/tag/getTopAlbums.js.map +1 -1
- package/dist/cjs/tag/getTopArtists.js +10 -0
- package/dist/cjs/tag/getTopArtists.js.map +1 -1
- package/dist/cjs/tag/getTopTags.js +7 -0
- package/dist/cjs/tag/getTopTags.js.map +1 -1
- package/dist/cjs/tag/getWeeklyChartList.js +9 -0
- package/dist/cjs/tag/getWeeklyChartList.js.map +1 -1
- package/dist/cjs/tag/topTracks.js +6 -3
- package/dist/cjs/tag/topTracks.js.map +1 -1
- package/dist/cjs/track/addTags.js +11 -0
- package/dist/cjs/track/addTags.js.map +1 -1
- package/dist/cjs/track/getCorrection.js +10 -0
- package/dist/cjs/track/getCorrection.js.map +1 -1
- package/dist/cjs/track/getInfo.js +11 -0
- package/dist/cjs/track/getInfo.js.map +1 -1
- package/dist/cjs/track/getSimilar.js +11 -0
- package/dist/cjs/track/getSimilar.js.map +1 -1
- package/dist/cjs/track/getTags.js +11 -0
- package/dist/cjs/track/getTags.js.map +1 -1
- package/dist/cjs/track/getTopTags.js +10 -0
- package/dist/cjs/track/getTopTags.js.map +1 -1
- package/dist/cjs/track/love.js +10 -0
- package/dist/cjs/track/love.js.map +1 -1
- package/dist/cjs/track/removeTag.js +11 -0
- package/dist/cjs/track/removeTag.js.map +1 -1
- package/dist/cjs/track/scrobble.js +12 -0
- package/dist/cjs/track/scrobble.js.map +1 -1
- package/dist/cjs/track/search.js +11 -0
- package/dist/cjs/track/search.js.map +1 -1
- package/dist/cjs/track/unlove.js +10 -0
- package/dist/cjs/track/unlove.js.map +1 -1
- package/dist/cjs/track/updateNowPlaying.js +11 -0
- package/dist/cjs/track/updateNowPlaying.js.map +1 -1
- package/dist/cjs/user/getPersonalTags.js +12 -0
- package/dist/cjs/user/getPersonalTags.js.map +1 -1
- package/dist/config.js.map +1 -1
- package/dist/createOptions.js +23 -0
- package/dist/createOptions.js.map +1 -1
- package/dist/geo/getTopArtists.js +10 -0
- package/dist/geo/getTopArtists.js.map +1 -1
- package/dist/geo/getTopTracks.js +10 -0
- package/dist/geo/getTopTracks.js.map +1 -1
- package/dist/getFriends.js +6 -3
- package/dist/getFriends.js.map +1 -1
- package/dist/getInfo.js +5 -3
- package/dist/getInfo.js.map +1 -1
- package/dist/getLovedTracks.js +7 -3
- package/dist/getLovedTracks.js.map +1 -1
- package/dist/getRecentTracks.js +7 -3
- package/dist/getRecentTracks.js.map +1 -1
- package/dist/getTopAlbums.js +7 -3
- package/dist/getTopAlbums.js.map +1 -1
- package/dist/getTopArtists.js +7 -3
- package/dist/getTopArtists.js.map +1 -1
- package/dist/getTopTracks.js +7 -3
- package/dist/getTopTracks.js.map +1 -1
- package/dist/getUserTopTags.js +6 -3
- package/dist/getUserTopTags.js.map +1 -1
- package/dist/getWeeklyAlbumChart.js +7 -3
- package/dist/getWeeklyAlbumChart.js.map +1 -1
- package/dist/getWeeklyArtistChart.js +7 -3
- package/dist/getWeeklyArtistChart.js.map +1 -1
- package/dist/getWeeklyChartList.js +8 -3
- package/dist/getWeeklyChartList.js.map +1 -1
- package/dist/getWeeklyTrackChart.js +7 -3
- package/dist/getWeeklyTrackChart.js.map +1 -1
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/dist/library/getArtists.js +10 -0
- package/dist/library/getArtists.js.map +1 -1
- package/dist/md5.js +77 -0
- package/dist/md5.js.map +1 -0
- package/dist/method.js +11 -0
- package/dist/method.js.map +1 -1
- package/dist/request.js +32 -2
- package/dist/request.js.map +1 -1
- package/dist/tag/getInfo.js +9 -0
- package/dist/tag/getInfo.js.map +1 -1
- package/dist/tag/getSimilar.js +8 -0
- package/dist/tag/getSimilar.js.map +1 -1
- package/dist/tag/getTopAlbums.js +10 -0
- package/dist/tag/getTopAlbums.js.map +1 -1
- package/dist/tag/getTopArtists.js +10 -0
- package/dist/tag/getTopArtists.js.map +1 -1
- package/dist/tag/getTopTags.js +7 -0
- package/dist/tag/getTopTags.js.map +1 -1
- package/dist/tag/getWeeklyChartList.js +9 -0
- package/dist/tag/getWeeklyChartList.js.map +1 -1
- package/dist/tag/topTracks.js +6 -3
- package/dist/tag/topTracks.js.map +1 -1
- package/dist/track/addTags.js +11 -0
- package/dist/track/addTags.js.map +1 -1
- package/dist/track/getCorrection.js +10 -0
- package/dist/track/getCorrection.js.map +1 -1
- package/dist/track/getInfo.js +11 -0
- package/dist/track/getInfo.js.map +1 -1
- package/dist/track/getSimilar.js +11 -0
- package/dist/track/getSimilar.js.map +1 -1
- package/dist/track/getTags.js +11 -0
- package/dist/track/getTags.js.map +1 -1
- package/dist/track/getTopTags.js +10 -0
- package/dist/track/getTopTags.js.map +1 -1
- package/dist/track/love.js +10 -0
- package/dist/track/love.js.map +1 -1
- package/dist/track/removeTag.js +11 -0
- package/dist/track/removeTag.js.map +1 -1
- package/dist/track/scrobble.js +12 -0
- package/dist/track/scrobble.js.map +1 -1
- package/dist/track/search.js +11 -0
- package/dist/track/search.js.map +1 -1
- package/dist/track/unlove.js +10 -0
- package/dist/track/unlove.js.map +1 -1
- package/dist/track/updateNowPlaying.js +11 -0
- package/dist/track/updateNowPlaying.js.map +1 -1
- package/dist/user/getPersonalTags.js +12 -0
- package/dist/user/getPersonalTags.js.map +1 -1
- package/package.json +13 -10
package/README.md
CHANGED
|
@@ -5,129 +5,195 @@
|
|
|
5
5
|
[](https://www.codacy.com/gh/mannuelf/lastfm-nodejs-client/dashboard?utm_source=github.com&utm_medium=referral&utm_content=mannuelf/lastfm-nodejs-client&utm_campaign=Badge_Grade)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
|
|
8
|
-
A
|
|
8
|
+
A TypeScript client for the [Last.fm API](https://www.last.fm/api). Works in Node.js ≥18 and all modern browsers — no polyfills required.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## Why use this
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
**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.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
**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.
|
|
15
|
+
|
|
16
|
+
**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`.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
15
19
|
|
|
16
20
|
```bash
|
|
17
|
-
pnpm
|
|
21
|
+
pnpm add lastfm-nodejs-client
|
|
18
22
|
```
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
```bash
|
|
25
|
+
npm install lastfm-nodejs-client
|
|
26
|
+
```
|
|
21
27
|
|
|
22
|
-
|
|
28
|
+
```bash
|
|
29
|
+
yarn add lastfm-nodejs-client
|
|
30
|
+
```
|
|
23
31
|
|
|
24
|
-
|
|
32
|
+
```bash
|
|
33
|
+
bun add lastfm-nodejs-client
|
|
34
|
+
```
|
|
25
35
|
|
|
26
|
-
```
|
|
27
|
-
|
|
36
|
+
```ts
|
|
37
|
+
// Deno
|
|
38
|
+
import LastFmApi from 'jsr:@mannuelf/lastfm-nodejs-client';
|
|
28
39
|
```
|
|
29
40
|
|
|
30
|
-
|
|
41
|
+
## Setup
|
|
42
|
+
|
|
43
|
+
Create a `.env` file in your project root:
|
|
31
44
|
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} from 'lastfm-nodejs-client/dist/@types/lastfm.types';
|
|
45
|
+
```bash
|
|
46
|
+
LASTFM_API_BASE_URL="https://ws.audioscrobbler.com/2.0/"
|
|
47
|
+
LASTFM_USER="your_username"
|
|
48
|
+
LASTFM_API_KEY="your_api_key"
|
|
49
|
+
LASTFM_APPNAME="your_app_name"
|
|
50
|
+
LASTFM_SHARED_SECRET="your_shared_secret"
|
|
39
51
|
```
|
|
40
52
|
|
|
41
|
-
|
|
53
|
+
Get your API key at [last.fm/api/account/create](https://www.last.fm/api/account/create).
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
42
56
|
|
|
43
|
-
|
|
57
|
+
```ts
|
|
58
|
+
import LastFmApi from 'lastfm-nodejs-client';
|
|
44
59
|
|
|
45
|
-
```js
|
|
46
60
|
const lastFm = LastFmApi();
|
|
47
|
-
const {
|
|
48
|
-
|
|
49
|
-
const getTopArtists = async () => {
|
|
50
|
-
const data = await lastFm.getTopArtists(
|
|
51
|
-
method.user.top_artists,
|
|
52
|
-
config.username,
|
|
53
|
-
'overall',
|
|
54
|
-
'200',
|
|
55
|
-
);
|
|
56
|
-
const { topartists } = data;
|
|
57
|
-
return topartists;
|
|
58
|
-
};
|
|
61
|
+
const { method } = lastFm;
|
|
59
62
|
```
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-

|
|
64
|
+
### Get a user's top artists
|
|
64
65
|
|
|
65
|
-
|
|
66
|
+
```ts
|
|
67
|
+
import LastFmApi from 'lastfm-nodejs-client';
|
|
68
|
+
import type { TopArtistsResponse } from 'lastfm-nodejs-client';
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
const lastFm = LastFmApi();
|
|
71
|
+
const { method } = lastFm;
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
const data: TopArtistsResponse = await lastFm.getTopArtists(
|
|
74
|
+
method.user.getTopArtists,
|
|
75
|
+
'your_username',
|
|
76
|
+
'overall', // period: overall | 7day | 1month | 3month | 6month | 12month
|
|
77
|
+
'10', // limit
|
|
78
|
+
);
|
|
70
79
|
|
|
71
|
-
|
|
72
|
-
gh repo fork mannuelf/lastfm-nodejs-client
|
|
80
|
+
console.log(data.topartists.artist);
|
|
73
81
|
```
|
|
74
82
|
|
|
75
|
-
|
|
83
|
+
### Get a user's recent tracks
|
|
76
84
|
|
|
77
|
-
|
|
85
|
+
```ts
|
|
86
|
+
import LastFmApi from 'lastfm-nodejs-client';
|
|
87
|
+
import type { RecentTracksResponse } from 'lastfm-nodejs-client';
|
|
78
88
|
|
|
79
|
-
|
|
89
|
+
const lastFm = LastFmApi();
|
|
90
|
+
const { method } = lastFm;
|
|
80
91
|
|
|
81
|
-
|
|
92
|
+
const data: RecentTracksResponse = await lastFm.getRecentTracks(
|
|
93
|
+
method.user.getRecentTracks,
|
|
94
|
+
'your_username',
|
|
95
|
+
'10', // limit
|
|
96
|
+
);
|
|
82
97
|
|
|
83
|
-
|
|
98
|
+
console.log(data.recenttracks.track);
|
|
99
|
+
```
|
|
84
100
|
|
|
85
|
-
|
|
101
|
+
### Get artist info
|
|
86
102
|
|
|
87
|
-
|
|
103
|
+
```ts
|
|
104
|
+
import LastFmApi from 'lastfm-nodejs-client';
|
|
105
|
+
import type { ArtistInfoResponse } from 'lastfm-nodejs-client';
|
|
88
106
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
LASTFM_USER=""
|
|
92
|
-
```
|
|
107
|
+
const lastFm = LastFmApi();
|
|
108
|
+
const { method } = lastFm;
|
|
93
109
|
|
|
94
|
-
|
|
110
|
+
const data: ArtistInfoResponse = await lastFm.artist.artistGetInfo(
|
|
111
|
+
method.artist.getInfo,
|
|
112
|
+
'Radiohead',
|
|
113
|
+
);
|
|
95
114
|
|
|
96
|
-
|
|
97
|
-
LASTFM_API_KEY=""
|
|
98
|
-
LASTFM_APPNAME=""
|
|
115
|
+
console.log(data.artist);
|
|
99
116
|
```
|
|
100
117
|
|
|
101
|
-
|
|
118
|
+
### Get album info
|
|
102
119
|
|
|
103
|
-
|
|
120
|
+
```ts
|
|
121
|
+
import LastFmApi from 'lastfm-nodejs-client';
|
|
122
|
+
import type { AlbumInfoResponse } from 'lastfm-nodejs-client';
|
|
104
123
|
|
|
105
|
-
|
|
106
|
-
|
|
124
|
+
const lastFm = LastFmApi();
|
|
125
|
+
const { method } = lastFm;
|
|
126
|
+
|
|
127
|
+
const data: AlbumInfoResponse = await lastFm.album.albumGetInfo(
|
|
128
|
+
method.album.getInfo,
|
|
129
|
+
'Radiohead',
|
|
130
|
+
'OK Computer',
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
console.log(data.album);
|
|
107
134
|
```
|
|
108
135
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
136
|
+
### Search for a track
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
import LastFmApi from 'lastfm-nodejs-client';
|
|
140
|
+
import type { TrackSearchResponse } from 'lastfm-nodejs-client';
|
|
141
|
+
|
|
142
|
+
const lastFm = LastFmApi();
|
|
143
|
+
const { method } = lastFm;
|
|
144
|
+
|
|
145
|
+
const data: TrackSearchResponse = await lastFm.track.trackSearch(
|
|
146
|
+
method.track.search,
|
|
147
|
+
'Creep',
|
|
148
|
+
'Radiohead', // optional artist filter
|
|
149
|
+
'5', // limit
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
console.log(data.results.trackmatches.track);
|
|
112
153
|
```
|
|
113
154
|
|
|
114
|
-
###
|
|
155
|
+
### Love a track (authenticated)
|
|
115
156
|
|
|
116
|
-
|
|
117
|
-
|
|
157
|
+
Requires a session key (`sk`) obtained via `auth.getMobileSession` or `auth.getSession`.
|
|
158
|
+
|
|
159
|
+
```ts
|
|
160
|
+
import LastFmApi from 'lastfm-nodejs-client';
|
|
161
|
+
|
|
162
|
+
const lastFm = LastFmApi();
|
|
163
|
+
const { method } = lastFm;
|
|
164
|
+
|
|
165
|
+
await lastFm.track.trackLove(method.track.love, 'Radiohead', 'Creep', 'your_session_key');
|
|
118
166
|
```
|
|
119
167
|
|
|
120
|
-
|
|
168
|
+
## All available namespaces
|
|
169
|
+
|
|
170
|
+
| Namespace | Methods |
|
|
171
|
+
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
172
|
+
| `album` | `albumGetInfo`, `albumGetTags`, `albumGetTopTags`, `albumSearch`, `albumAddTags`, `albumRemoveTag` |
|
|
173
|
+
| `artist` | `artistGetInfo`, `artistGetSimilar`, `artistGetTags`, `artistGetTopAlbums`, `artistGetTopTags`, `artistGetTopTracks`, `artistSearch`, `artistAddTags`, `artistRemoveTag`, `artistGetCorrection` |
|
|
174
|
+
| `auth` | `getToken`, `getSession`, `getMobileSession` |
|
|
175
|
+
| `chart` | `chartTopArtists`, `chartTopTracks`, `chartTopTags` |
|
|
176
|
+
| `geo` | `geoGetTopArtists`, `geoGetTopTracks` |
|
|
177
|
+
| `library` | `libraryGetArtists` |
|
|
178
|
+
| `tag` | `tagGetInfo`, `tagGetSimilar`, `tagGetTopAlbums`, `tagGetTopArtists`, `tagGetTopTags`, `tagGetWeeklyChartList`, `tagTopTracks` |
|
|
179
|
+
| `track` | `trackGetInfo`, `trackGetSimilar`, `trackGetTags`, `trackGetTopTags`, `trackSearch`, `trackLove`, `trackUnlove`, `trackAddTags`, `trackRemoveTag`, `trackScrobble`, `trackUpdateNowPlaying`, `trackGetCorrection` |
|
|
180
|
+
| `user` | `userGetPersonalTags` |
|
|
181
|
+
|
|
182
|
+
Legacy flat methods also available: `getTopArtists`, `getTopTracks`, `getRecentTracks`, `getLovedTracks`, `getInfo`, `getFriends`, `getUserTopTags`, `getWeeklyAlbumChart`, `getWeeklyArtistChart`, `getWeeklyChartList`, `getWeeklyTrackChart`, `getTopAlbums`.
|
|
183
|
+
|
|
184
|
+
## Developing
|
|
121
185
|
|
|
122
186
|
```bash
|
|
123
|
-
|
|
124
|
-
pnpm publish
|
|
187
|
+
gh repo fork mannuelf/lastfm-nodejs-client
|
|
125
188
|
```
|
|
126
189
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
190
|
+
```bash
|
|
191
|
+
pnpm install
|
|
192
|
+
pnpm test
|
|
193
|
+
pnpm lint
|
|
194
|
+
pnpm build
|
|
195
|
+
```
|
|
130
196
|
|
|
131
|
-
###
|
|
197
|
+
### Why I built this
|
|
132
198
|
|
|
133
|
-
|
|
199
|
+
I was building a scrobbles page at [mannuelferreira.com/scrobbles](https://mannuelferreira.com/scrobbles) and thought others might find it useful.
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { AuthResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Tag an album using a list of user-supplied tags. Requires authentication.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/album.addTags
|
|
6
|
+
* @param method - The Last.fm API method string (`method.album.addTags`)
|
|
7
|
+
* @param artist - The artist name
|
|
8
|
+
* @param album - The album name
|
|
9
|
+
* @param tags - A comma-separated list of tags to apply (max 10)
|
|
10
|
+
* @param sk - A session key obtained via the auth flow
|
|
11
|
+
* @returns Authentication response confirming the operation
|
|
12
|
+
*/
|
|
2
13
|
export declare function albumAddTags(method: string, artist: string, album: string, tags: string, sk: string): Promise<AuthResponse>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { AlbumInfoResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the metadata and tracklist for an album on Last.fm.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/album.getInfo
|
|
6
|
+
* @param method - The Last.fm API method string (`method.album.getInfo`)
|
|
7
|
+
* @param artist - The artist name
|
|
8
|
+
* @param album - The album name
|
|
9
|
+
* @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
|
|
10
|
+
* @param lang - ISO 639 alpha-2 language code for the biography text (default `'en'`)
|
|
11
|
+
* @returns Album metadata including tracklist, wiki, and tags
|
|
12
|
+
*/
|
|
2
13
|
export declare function albumGetInfo(method: string, artist: string, album: string, autocorrect?: string, lang?: string): Promise<AlbumInfoResponse>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { AlbumTagsResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the tags applied by an individual user to an album on Last.fm.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/album.getTags
|
|
6
|
+
* @param method - The Last.fm API method string (`method.album.getTags`)
|
|
7
|
+
* @param artist - The artist name
|
|
8
|
+
* @param album - The album name
|
|
9
|
+
* @param user - The Last.fm username whose tags to retrieve
|
|
10
|
+
* @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
|
|
11
|
+
* @returns Tags applied by the user to this album
|
|
12
|
+
*/
|
|
2
13
|
export declare function albumGetTags(method: string, artist: string, album: string, user: string, autocorrect?: string): Promise<AlbumTagsResponse>;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { AlbumTopTagsResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the top tags applied to an album on Last.fm, ordered by tag count.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/album.getTopTags
|
|
6
|
+
* @param method - The Last.fm API method string (`method.album.getTopTags`)
|
|
7
|
+
* @param artist - The artist name
|
|
8
|
+
* @param album - The album name
|
|
9
|
+
* @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
|
|
10
|
+
* @returns Top tags for the album ordered by tag count
|
|
11
|
+
*/
|
|
2
12
|
export declare function albumGetTopTags(method: string, artist: string, album: string, autocorrect?: string): Promise<AlbumTopTagsResponse>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { AuthResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Remove a user-applied tag from an album. Requires authentication.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/album.removeTag
|
|
6
|
+
* @param method - The Last.fm API method string (`method.album.removeTag`)
|
|
7
|
+
* @param artist - The artist name
|
|
8
|
+
* @param album - The album name
|
|
9
|
+
* @param tag - A single tag to remove from the album
|
|
10
|
+
* @param sk - A session key obtained via the auth flow
|
|
11
|
+
* @returns Authentication response confirming the operation
|
|
12
|
+
*/
|
|
2
13
|
export declare function albumRemoveTag(method: string, artist: string, album: string, tag: string, sk: string): Promise<AuthResponse>;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { AlbumSearchResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Search for an album by name on Last.fm. Returns paginated results.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/album.search
|
|
6
|
+
* @param method - The Last.fm API method string (`method.album.search`)
|
|
7
|
+
* @param album - The album name to search for
|
|
8
|
+
* @param limit - Number of results per page (default `'30'`)
|
|
9
|
+
* @param page - Page number to fetch (default `'1'`)
|
|
10
|
+
* @returns Paginated album search results
|
|
11
|
+
*/
|
|
2
12
|
export declare function albumSearch(method: string, album: string, limit?: string, page?: string): Promise<AlbumSearchResponse>;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { AuthResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Tag an artist using a list of user-supplied tags. Requires authentication.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/artist.addTags
|
|
6
|
+
* @param method - The Last.fm API method string (`method.artist.addTags`)
|
|
7
|
+
* @param artist - The artist name
|
|
8
|
+
* @param tags - A comma-separated list of tags to apply (max 10)
|
|
9
|
+
* @param sk - A session key obtained via the auth flow
|
|
10
|
+
* @returns Authentication response confirming the operation
|
|
11
|
+
*/
|
|
2
12
|
export declare function artistAddTags(method: string, artist: string, tags: string, sk: string): Promise<AuthResponse>;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import type { ArtistCorrectionResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Use the Last.fm corrections data to check whether the supplied artist has a correction
|
|
4
|
+
* to a canonical artist name.
|
|
5
|
+
*
|
|
6
|
+
* @see https://www.last.fm/api/show/artist.getCorrection
|
|
7
|
+
* @param method - The Last.fm API method string (`method.artist.getCorrection`)
|
|
8
|
+
* @param artist - The artist name to check for a correction
|
|
9
|
+
* @returns The corrected canonical artist name if one exists
|
|
10
|
+
*/
|
|
2
11
|
export declare function artistGetCorrection(method: string, artist: string): Promise<ArtistCorrectionResponse>;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { ArtistInfoResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the metadata for an artist on Last.fm. Includes biography, tags, and similar artists.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/artist.getInfo
|
|
6
|
+
* @param method - The Last.fm API method string (`method.artist.getInfo`)
|
|
7
|
+
* @param artist - The artist name
|
|
8
|
+
* @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
|
|
9
|
+
* @param lang - ISO 639 alpha-2 language code for the biography text (default `'en'`)
|
|
10
|
+
* @returns Artist metadata including biography, similar artists, and top tags
|
|
11
|
+
*/
|
|
2
12
|
export declare function artistGetInfo(method: string, artist: string, autocorrect?: string, lang?: string): Promise<ArtistInfoResponse>;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { ArtistSimilarResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get all the artists similar to this artist.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/artist.getSimilar
|
|
6
|
+
* @param method - The Last.fm API method string (`method.artist.getSimilar`)
|
|
7
|
+
* @param artist - The artist name
|
|
8
|
+
* @param limit - Maximum number of similar artists to return (default `'30'`)
|
|
9
|
+
* @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
|
|
10
|
+
* @returns A list of similar artists with match scores
|
|
11
|
+
*/
|
|
2
12
|
export declare function artistGetSimilar(method: string, artist: string, limit?: string, autocorrect?: string): Promise<ArtistSimilarResponse>;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { ArtistTagsResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the tags applied by an individual user to an artist on Last.fm.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/artist.getTags
|
|
6
|
+
* @param method - The Last.fm API method string (`method.artist.getTags`)
|
|
7
|
+
* @param artist - The artist name
|
|
8
|
+
* @param user - The Last.fm username whose tags to retrieve
|
|
9
|
+
* @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
|
|
10
|
+
* @returns Tags applied by the user to this artist
|
|
11
|
+
*/
|
|
2
12
|
export declare function artistGetTags(method: string, artist: string, user: string, autocorrect?: string): Promise<ArtistTagsResponse>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { ArtistTopAlbumsResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the top albums for an artist on Last.fm, ordered by popularity.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/artist.getTopAlbums
|
|
6
|
+
* @param method - The Last.fm API method string (`method.artist.getTopAlbums`)
|
|
7
|
+
* @param artist - The artist name
|
|
8
|
+
* @param limit - Number of results per page (default `'50'`)
|
|
9
|
+
* @param page - Page number to fetch (default `'1'`)
|
|
10
|
+
* @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
|
|
11
|
+
* @returns Paginated list of the artist's top albums
|
|
12
|
+
*/
|
|
2
13
|
export declare function artistGetTopAlbums(method: string, artist: string, limit?: string, page?: string, autocorrect?: string): Promise<ArtistTopAlbumsResponse>;
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import type { ArtistTopTagsResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the top tags for an artist on Last.fm, ordered by popularity.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/artist.getTopTags
|
|
6
|
+
* @param method - The Last.fm API method string (`method.artist.getTopTags`)
|
|
7
|
+
* @param artist - The artist name
|
|
8
|
+
* @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
|
|
9
|
+
* @returns Top tags for the artist ordered by tag count
|
|
10
|
+
*/
|
|
2
11
|
export declare function artistGetTopTags(method: string, artist: string, autocorrect?: string): Promise<ArtistTopTagsResponse>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { ArtistTopTracksResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the top tracks for an artist on Last.fm, ordered by popularity.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/artist.getTopTracks
|
|
6
|
+
* @param method - The Last.fm API method string (`method.artist.getTopTracks`)
|
|
7
|
+
* @param artist - The artist name
|
|
8
|
+
* @param limit - Number of results per page (default `'50'`)
|
|
9
|
+
* @param page - Page number to fetch (default `'1'`)
|
|
10
|
+
* @param autocorrect - Set to `'1'` to auto-correct misspelled names (default `'1'`)
|
|
11
|
+
* @returns Paginated list of the artist's top tracks
|
|
12
|
+
*/
|
|
2
13
|
export declare function artistGetTopTracks(method: string, artist: string, limit?: string, page?: string, autocorrect?: string): Promise<ArtistTopTracksResponse>;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { AuthResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Remove a user-applied tag from an artist. Requires authentication.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/artist.removeTag
|
|
6
|
+
* @param method - The Last.fm API method string (`method.artist.removeTag`)
|
|
7
|
+
* @param artist - The artist name
|
|
8
|
+
* @param tag - A single tag to remove from the artist
|
|
9
|
+
* @param sk - A session key obtained via the auth flow
|
|
10
|
+
* @returns Authentication response confirming the operation
|
|
11
|
+
*/
|
|
2
12
|
export declare function artistRemoveTag(method: string, artist: string, tag: string, sk: string): Promise<AuthResponse>;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { ArtistSearchResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Search for an artist by name on Last.fm. Returns paginated results.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/artist.search
|
|
6
|
+
* @param method - The Last.fm API method string (`method.artist.search`)
|
|
7
|
+
* @param artist - The artist name to search for
|
|
8
|
+
* @param limit - Number of results per page (default `'30'`)
|
|
9
|
+
* @param page - Page number to fetch (default `'1'`)
|
|
10
|
+
* @returns Paginated artist search results
|
|
11
|
+
*/
|
|
2
12
|
export declare function artistSearch(method: string, artist: string, limit?: string, page?: string): Promise<ArtistSearchResponse>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { AuthMobileSessionResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a session for a user using their username and password (mobile auth flow).
|
|
4
|
+
*
|
|
5
|
+
* The returned session key can be used for authenticated write operations.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.last.fm/api/show/auth.getMobileSession
|
|
8
|
+
* @param method - The Last.fm API method string (`method.auth.getMobileSession`)
|
|
9
|
+
* @param username - The Last.fm username
|
|
10
|
+
* @param password - The user's plaintext password
|
|
11
|
+
* @returns A session key valid for write operations
|
|
12
|
+
*/
|
|
2
13
|
export declare function authGetMobileSession(method: string, username: string, password: string): Promise<AuthMobileSessionResponse>;
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { AuthSessionResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Fetch a session key for a user after they have authorised a token via the Last.fm web auth flow.
|
|
4
|
+
*
|
|
5
|
+
* Tokens are valid for 60 minutes and can only be used once.
|
|
6
|
+
*
|
|
7
|
+
* @see https://www.last.fm/api/show/auth.getSession
|
|
8
|
+
* @param method - The Last.fm API method string (`method.auth.getSession`)
|
|
9
|
+
* @param token - The token previously granted by `auth.getToken` and authorised by the user
|
|
10
|
+
* @returns A session key valid for write operations
|
|
11
|
+
*/
|
|
2
12
|
export declare function authGetSession(method: string, token: string): Promise<AuthSessionResponse>;
|
package/dist/@types/auth.d.ts
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { type AuthResponse } from './lastfm.types.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Fetch an unauthenticated token for the web auth flow.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* Tokens are API-account-specific, valid for 60 minutes, and consumed
|
|
6
|
+
* once a session is created via `auth.getSession`.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
8
|
+
* @see https://www.last.fm/api/show/auth.getToken
|
|
9
|
+
* @param method - The Last.fm API method string (`method.auth.getToken`)
|
|
10
|
+
* @param user - The Last.fm username
|
|
11
|
+
* @param period - The time period parameter
|
|
12
|
+
* @param limit - The limit parameter
|
|
13
|
+
* @returns An unauthenticated token to redirect the user to the Last.fm auth page
|
|
11
14
|
*/
|
|
12
15
|
export declare function auth(method: string, user: string, period: string, limit: string): Promise<AuthResponse>;
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { ChartTopArtistResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the top artists chart on Last.fm.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/chart.getTopArtists
|
|
6
|
+
* @param method - The Last.fm API method string (`method.chart.getTopArtists`)
|
|
7
|
+
* @param user - The Last.fm username
|
|
8
|
+
* @param period - The time period over which to retrieve the chart
|
|
9
|
+
* @param page - Page number to fetch
|
|
10
|
+
* @param limit - Number of results per page
|
|
11
|
+
* @returns Paginated list of the most popular artists globally
|
|
12
|
+
*/
|
|
2
13
|
export declare function chartTopArtists(method: string, user: string, period: string, page: string, limit: string): Promise<ChartTopArtistResponse>;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import type { ChartTopTagsResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the top tags chart on Last.fm, ordered by tag popularity.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/chart.getTopTags
|
|
6
|
+
* @param method - The Last.fm API method string (`method.chart.getTopTags`)
|
|
7
|
+
* @param page - Page number to fetch
|
|
8
|
+
* @returns Paginated list of the most popular tags globally
|
|
9
|
+
*/
|
|
2
10
|
export declare function chartTopTags(method: string, page: string): Promise<ChartTopTagsResponse>;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
import type { ChartTopTracksResponse } from '../lastfm.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Get the top tracks chart on Last.fm.
|
|
4
|
+
*
|
|
5
|
+
* @see https://www.last.fm/api/show/chart.getTopTracks
|
|
6
|
+
* @param method - The Last.fm API method string (`method.chart.getTopTracks`)
|
|
7
|
+
* @param page - Page number to fetch
|
|
8
|
+
* @returns Paginated list of the most popular tracks globally
|
|
9
|
+
*/
|
|
2
10
|
export declare function chartTopTracks(method: string, page: string): Promise<ChartTopTracksResponse>;
|
package/dist/@types/config.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* @description Stores the Last.fm API key, app name, base url, format, shared secret, and username.
|
|
3
|
-
* Simply add a .env file to the root of the project and add the following:
|
|
4
|
-
* LASTFM_API_KEY=your_api_key
|
|
5
|
-
* LASTFM_APPNAME=your_app_name
|
|
6
|
-
* LASTFM_API_BASE_URL=your_base_url
|
|
7
|
-
* LASTFM_SHARED_SECRET=your_shared_secret
|
|
8
|
-
* LASTFM_USER=your_username
|
|
9
|
-
*/
|
|
10
|
-
export declare const config: {
|
|
1
|
+
interface Config {
|
|
11
2
|
api_key: string;
|
|
12
3
|
app_name: string;
|
|
13
4
|
base_url: string;
|
|
@@ -17,4 +8,15 @@ export declare const config: {
|
|
|
17
8
|
};
|
|
18
9
|
share_secret: string;
|
|
19
10
|
username: string;
|
|
20
|
-
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @description Stores the Last.fm API key, app name, base url, format, shared secret, and username.
|
|
14
|
+
* Simply add a .env file to the root of the project and add the following:
|
|
15
|
+
* LASTFM_API_KEY=your_api_key
|
|
16
|
+
* LASTFM_APPNAME=your_app_name
|
|
17
|
+
* LASTFM_API_BASE_URL=your_base_url
|
|
18
|
+
* LASTFM_SHARED_SECRET=your_shared_secret
|
|
19
|
+
* LASTFM_USER=your_username
|
|
20
|
+
*/
|
|
21
|
+
export declare const config: Config;
|
|
22
|
+
export {};
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a request options object for use with `request` or `signedRequest`.
|
|
3
|
+
*
|
|
4
|
+
* @param method - The Last.fm API method string (e.g. `'user.getInfo'`)
|
|
5
|
+
* @param user - Last.fm username
|
|
6
|
+
* @param period - Time period (`overall`, `7day`, `1month`, `3month`, `6month`, `12month`)
|
|
7
|
+
* @param limit - Number of results to return per page
|
|
8
|
+
* @param page - Page number for paginated results (1-indexed)
|
|
9
|
+
* @param from - Unix timestamp; only return scrobbles after this time
|
|
10
|
+
* @param tag - Tag name
|
|
11
|
+
* @param artist - Artist name
|
|
12
|
+
* @param album - Album title
|
|
13
|
+
* @param track - Track title
|
|
14
|
+
* @param country - Country name as defined by the ISO 3166-1 standard
|
|
15
|
+
* @param autocorrect - Set to `'1'` to auto-correct misspelled artist/track names
|
|
16
|
+
* @param mbid - MusicBrainz ID for the resource
|
|
17
|
+
* @param lang - ISO 639 alpha-2 language code for localised text (default `'en'`)
|
|
18
|
+
* @param sk - Session key obtained via the auth flow
|
|
19
|
+
* @param token - Authentication token from `auth.getToken`
|
|
20
|
+
* @param tags - Comma-separated list of user-supplied tags (max 10)
|
|
21
|
+
* @param timestamp - Unix timestamp of the scrobble
|
|
22
|
+
* @returns A request options object ready to pass to `request` or `signedRequest`
|
|
23
|
+
*/
|
|
1
24
|
export declare function createOptions(method: string, user: string, period?: string, limit?: string, page?: string, from?: string, tag?: string, artist?: string, album?: string, track?: string, country?: string, autocorrect?: string, mbid?: string, lang?: string, sk?: string, token?: string, tags?: string, timestamp?: string): {
|
|
2
25
|
method: string;
|
|
3
26
|
page: string | undefined;
|