download entire library code
This commit is contained in:
parent
aabbb35583
commit
10dba24da2
1 changed files with 33 additions and 8 deletions
|
@ -13,12 +13,12 @@
|
||||||
// &fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url
|
// &fields[albums]=artistName,artistUrl,artwork,contentRating,editorialArtwork,editorialVideo,name,playParams,releaseDate,url
|
||||||
// &fields[artists]=name,url&extend[stations]=airDate,supportsAirTimeUpdates&meta[stations]=inflectionPoints
|
// &fields[artists]=name,url&extend[stations]=airDate,supportsAirTimeUpdates&meta[stations]=inflectionPoints
|
||||||
// &types=artists,albums,editorial-items,library-albums,library-playlists,music-movies,music-videos,playlists,stations,uploaded-audios,uploaded-videos,activities,apple-curators,curators,tv-shows,social-profiles,social-upsells
|
// &types=artists,albums,editorial-items,library-albums,library-playlists,music-movies,music-videos,playlists,stations,uploaded-audios,uploaded-videos,activities,apple-curators,curators,tv-shows,social-profiles,social-upsells
|
||||||
// &l=en-gb&platform=web
|
// &l=en-gb&platform=web
|
||||||
|
|
||||||
await app.mk.api.personalRecommendations("",
|
await app.mk.api.personalRecommendations("",
|
||||||
{
|
{
|
||||||
name: "listen-now",
|
name: "listen-now",
|
||||||
with: "friendsMix,library,social",
|
with: "friendsMix,library,social",
|
||||||
"art[social-profiles:url]":"c",
|
"art[social-profiles:url]":"c",
|
||||||
"art[url]": "c,f",
|
"art[url]": "c,f",
|
||||||
"omit[resource]": "autos",
|
"omit[resource]": "autos",
|
||||||
|
@ -38,15 +38,15 @@ await app.mk.api.personalRecommendations("",
|
||||||
"meta[stations]": "inflectionPoints",
|
"meta[stations]": "inflectionPoints",
|
||||||
types: "artists,albums,editorial-items,library-albums,library-playlists,music-movies,music-videos,playlists,stations,uploaded-audios,uploaded-videos,activities,apple-curators,curators,tv-shows,social-profiles,social-upsells",
|
types: "artists,albums,editorial-items,library-albums,library-playlists,music-movies,music-videos,playlists,stations,uploaded-audios,uploaded-videos,activities,apple-curators,curators,tv-shows,social-profiles,social-upsells",
|
||||||
l:"en-gb",
|
l:"en-gb",
|
||||||
platform:"web"
|
platform:"web"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
includeResponseMeta: !0,
|
includeResponseMeta: !0,
|
||||||
reload: !0
|
reload: !0
|
||||||
});
|
});
|
||||||
|
|
||||||
// Browse page
|
// Browse page
|
||||||
await app.mk.api.groupings("",
|
await app.mk.api.groupings("",
|
||||||
{
|
{
|
||||||
platform: "web",
|
platform: "web",
|
||||||
name: "music",
|
name: "music",
|
||||||
|
@ -58,7 +58,7 @@ await app.mk.api.groupings("",
|
||||||
extend: "editorialArtwork,artistUrl",
|
extend: "editorialArtwork,artistUrl",
|
||||||
"fields[artists]": "name,url,artwork,editorialArtwork,genreNames,editorialNotes",
|
"fields[artists]": "name,url,artwork,editorialArtwork,genreNames,editorialNotes",
|
||||||
"art[url]": "f"
|
"art[url]": "f"
|
||||||
});
|
});
|
||||||
|
|
||||||
// Radio page
|
// Radio page
|
||||||
await app.mk.api.recentRadioStations("",
|
await app.mk.api.recentRadioStations("",
|
||||||
|
@ -94,3 +94,28 @@ app.mk.api.recommendations("",{extend: "editorialArtwork,artistUrl"})
|
||||||
await app.mk.api.library.songs("", {limit: 100}, {includeResponseMeta: !0}).then((data)=>{
|
await app.mk.api.library.songs("", {limit: 100}, {includeResponseMeta: !0}).then((data)=>{
|
||||||
console.log(data)
|
console.log(data)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// download entire library
|
||||||
|
var library = []
|
||||||
|
var downloaded = null;
|
||||||
|
function downloadChunk () {
|
||||||
|
if(downloaded == null) {
|
||||||
|
app.mk.api.library.songs("", {limit: 100}, {includeResponseMeta: !0}).then((response)=>{
|
||||||
|
processChunk(response)
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
downloaded.next("", {limit: 100}, {includeResponseMeta: !0}).then((response)=>{
|
||||||
|
processChunk(response)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function processChunk (response) {
|
||||||
|
downloaded = response
|
||||||
|
library = library.concat(downloaded.data)
|
||||||
|
if (downloaded.meta.total > library.length) {
|
||||||
|
console.log(`downloading next chunk - ${library.length} songs so far`)
|
||||||
|
downloadChunk()
|
||||||
|
} else {
|
||||||
|
console.log(library)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue