Skip to content
This repository has been archived by the owner on Mar 6, 2022. It is now read-only.

Commit

Permalink
Update getting data according to apple music changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackhawk-TA committed Apr 27, 2021
1 parent 5ae8b74 commit b6b499b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b6b499b

Please sign in to comment.