From b6b499bb8790f79d83888590babaa208a2fc5e13 Mon Sep 17 00:00:00 2001 From: Blackhawk Date: Tue, 27 Apr 2021 20:33:14 +0200 Subject: [PATCH] Update getting data according to apple music changes --- package.json | 2 +- src/main.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 7dbf1e2..0c560cb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "apple-music-playlist", - "version": "1.1.0", + "version": "1.1.1", "description": "Fetch playlist data from apple music", "main": "src/main.js", "scripts": { diff --git a/src/main.js b/src/main.js index 8e2cc9b..e032db1 100644 --- a/src/main.js +++ b/src/main.js @@ -14,19 +14,19 @@ module.exports = { } else { axios.get(url).then(res => { let $ = cheerio.load(res.data), - aTitleDivs = $(".song-name").toArray(), - aArtistDivs = $(".dt-link-to").toArray(), + aTitleDivs = $(".songs-list-row__song-name").toArray(), + aArtistDivs = $(".songs-list-row__link").toArray(), aPlaylist = [], i, j = 0; for (i = 0; i < aTitleDivs.length; i++) { aPlaylist.push({ - album: aArtistDivs[j + 1].firstChild.data, + album: aArtistDivs[j + 2].firstChild.data, artist: aArtistDivs[j].firstChild.data, title: aTitleDivs[i].lastChild.data }); - j += 2; + j += 3; } resolve(aPlaylist);