Skip to content

Instantly share code, notes, and snippets.

View thek27's full-sized avatar

Kostas Theodorou thek27

View GitHub Profile
@thek27
thek27 / getPlaylists.js
Last active January 9, 2022 21:37
Using promises to get all playlists of a spotify user with one function (requires spotify-web-api-node)
const SpotifyWebApi = require("spotify-web-api-node");
const spotifyApi = new SpotifyWebApi();
spotifyApi.setAccessToken(process.env.ACCESS_TOKEN);
const getPlaylists = function (userId, offset = 0, limit = 50, lists = []) {
console.log("offset", offset);
return new Promise((resolve, reject) =>
spotifyApi