(async() => {
awaitSpottyDL.getTrack("https://open.spotify.com/track/4cOdK2wGLETKBW3PvgPWqT")
.then(async(results) => {
let track = awaitSpottyDL.downloadTrack(results, "~/somePath") // Second parameter is optional...console.log(track)
});
})();
/* Example Output (Successful)
[
{ status: 'Success', filename: '~/somePath/Never Gonna Give You Up.mp3' }
]
*//* Example Output (Failed)
[
{
status: 'Failed (stream)',
filename: ~/somePath/Never Gonna Give You Up.mp3,
id: 'lYBUbBu4W08', // videoId from YT-Music
tags: {
title: 'Never Gonna Give You Up',
artist: 'Rick Astley',
year: '1987-11-12',
...
}
}
]
*/
Downloading an Album/Single
(async() => {
awaitSpottyDL.getAlbum("https://open.spotify.com/album/66MRfhZmuTuyGCO1dJZTRB")
.then(async(results) => {
let album = awaitSpottyDL.downloadAlbum(results, "output/", false)
console.log(album)
});
})();
/* Example Output (Successful)
[
{ status: 'Success', filename: 'output/Crush.mp3' },
{ status: 'Success', filename: 'output/Sesame Syrup.mp3' }
]
*//* Example Output (Failed) some tracks failed proceed to use `retryDownload()` method
[
{
status: 'Failed (Stream)',
filename: 'output/Crush.mp3',
id: YT-Music id,
tags: {
// tags for the track...
}
},
{ status: 'Success', filename: 'output/Sesame Syrup.mp3' }
]
*/
Retrying a failed download (Album/Track)
(async() => {
awaitSpottyDL.getAlbum("https://open.spotify.com/album/66MRfhZmuTuyGCO1dJZTRB")
.then(async(results) => {
let album = awaitSpottyDL.downloadAlbum(results, "output/", false)
let res = awaitSpottyDL.retryDownload(album);
console.log(res) // boolean or <Results[]>
});
})();
// Using a while loop until all tracks have no errors (Experimental)
(async() => {
awaitSpottyDL.getAlbum("https://open.spotify.com/album/66MRfhZmuTuyGCO1dJZTRB")
.then(async(results) => {
let album = awaitSpottyDL.downloadAlbum(results, "output/", false)
let res = awaitSpottyDL.retryDownload(album);
while(res != true) {
res = awaitSpottyDL.retryDownload(res);
console.log(res) // boolean or <Results[]>
}
});
})();
Notes
What this module simply does is that it scrapes data from Spotify, then finds the right track/song from Youtube-Music.
Hence, there's no illegal action or DRM bypass being done within this module, as all data is freely taken and used the right way
NodeJS Spotify Downloader without any API Keys or Authentication
We found that spottydl demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.
Last updated on 05 Feb 2022
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
CISA launched a new project called Vulnrichment to enrich CVEs with details that help prioritize patching and mitigation efforts, as the NVD backlog of unenriched CVEs awaiting analysis surpasses 10,000.
Socket is joining forces with CISA and other industry leaders at the RSA Conference to sign the Secure by Design pledge, committing to uphold the highest security standards in our products.
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.