1.7.4 • Published 2 years ago

@spotistats/spotify.js v1.7.4

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
2 years ago

spotify.js

CI

An API wrapper for Spotify, written in Typescript. Made for Stats.fm (formerly known as Spotistats for Spotify).

Documentation.

Features

  • Support for both the authorization code flow and the client credentials flow.
  • Automatic token refreshing.
  • Retries requests when the ratelimit is hit.
  • Highly configurable.

Usage

# using yarn
yarn add @statsfm/spotify.js
# or with npm
npm install @statsfm/spotify.js
import { SpotifyAPI } from '@statsfm/spotify.js';

const api = new SpotifyAPI({
  clientCredentials: {
    clientId: '',
    clientSecret: '',
  },
  accessToken: '', // optional, required for private user data
  refreshToken: '', // optional, required for private user data and automatic token refreshing
});

const tracks = await api.tracks
  .list([
    '2cc8Sw1OnCuA5bV8nqWqpE',
    '4a8pP5X2lxwU5aprY44jLn',
    '5lIFsEWj9IjNEALbHnPosE',
    '4S4RWAA749dKyJQ5CiKEBJ',
    '4ZtFanR9U6ndgddUvNcjcG',
  ])
  .then((tracks) => {
    tracks.forEach((track) => {
      console.log(`${track.name} - ${track.artists[0].name}`);
    });
  })
  .catch(console.error);

Maintainers

1.7.3

2 years ago

1.6.2

2 years ago

1.7.0

2 years ago

1.6.1

2 years ago

1.6.0

2 years ago

1.7.4

2 years ago

1.5.1

2 years ago

1.5.0

3 years ago

1.4.4

3 years ago

1.4.3

3 years ago

1.4.2

3 years ago

1.4.1

3 years ago

1.4.0

3 years ago

1.3.0

3 years ago

1.2.0

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago