Fixed spotify playlist 20 entries limit

This commit is contained in:
RemixDev
2021-06-27 11:50:00 +02:00
parent ea9d045075
commit 9b157c42bc
3 changed files with 8 additions and 6 deletions

View File

@@ -18,7 +18,8 @@ const handler = (req, res) => __awaiter(void 0, void 0, void 0, function* () {
const username = req.query.spotifyUser;
data = [];
let playlists = yield sp.getUserPlaylists(username);
let playlistList = playlists.body.items;
playlists = playlists.body;
let playlistList = playlists.items;
while (playlists.next) {
const regExec = /offset=(\d+)&limit=(\d+)/g.exec(playlists.next);
const offset = regExec[1];

View File

@@ -11,7 +11,8 @@ const handler: ApiHandler['handler'] = async (req, res) => {
const username = req.query.spotifyUser
data = []
let playlists = await sp.getUserPlaylists(username)
let playlistList = playlists.body.items
playlists = playlists.body
let playlistList = playlists.items
while (playlists.next) {
const regExec = /offset=(\d+)&limit=(\d+)/g.exec(playlists.next)
const offset = regExec![1]