Skip to content

Instantly share code, notes, and snippets.

@felipeluna
Forked from icodeforlove/bandcamp.js
Last active December 23, 2017 15:55
Show Gist options
  • Save felipeluna/e20f21157ada8e0ec6699ae545c9c032 to your computer and use it in GitHub Desktop.
Save felipeluna/e20f21157ada8e0ec6699ae545c9c032 to your computer and use it in GitHub Desktop.
download mp3's from bandcamp
var commands = [];
commands.push('mkdir "' + TralbumData.current.title + '"');
commands.push('cd "' + TralbumData.current.title + '"');
TralbumData.trackinfo.forEach(function (track, index) {
if (track.file) {
var href = track.file['mp3-128'];
if (href.startsWith("//")) {
href = "https:" + href
}
filename = ("0" + (index+1)).slice(-2) + ". " + track.title
commands.push('curl -o "' + filename + '.mp3" -L "' + href + '"&');
}
});
commands.push('cd ../');
console.log(commands.join('\n'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment