Last active
December 15, 2019 05:01
-
-
Save namazso/2773e6a5a9ea372f894cfd1acc35ae2f to your computer and use it in GitHub Desktop.
Monstercat Gold mass downloader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use https://addons.mozilla.org/en-US/firefox/addon/export-cookies-txt/ for making cookies.txt | |
# downloading as zip is broken at the time of writing, therefore per-track downloading is used. | |
# getting tracks for all releases is also broken at the time, so releases without catalog id | |
# are still downloaded as zips because you can get zips without the track ids or catalog id. | |
$format = "flac"; | |
$args = @{ | |
skip=0 | |
limit=50 | |
}; | |
$api = "https://connect.monstercat.com/v2/"; | |
$first = Invoke-RestMethod ($api + "releases") -Method Get -Body $args; | |
$total = ($first.total + 1) / 50; | |
$r = $first.results; | |
For ($i = 1; $i -lt $total; $i += 1) { | |
$args["skip"] = $i * 50; | |
$r += (Invoke-RestMethod ($api + "releases") -Method Get -Body $args).results; | |
} | |
$links = ($r | % { | |
If ($_.catalogID -eq "") { | |
$api + "release/" + $_.id + "/download?format=" + $format; | |
} Else { | |
$curr = Invoke-RestMethod ($api + "catalog/release/" + $_.catalogID) | |
$curr.tracks | % { | |
$api + "release/" + $curr.release.id + "/track-download/" + $_.id + "?format=" + $format | |
} | |
} | |
} | Sort-Object | Get-Unique) | |
$links > links.txt | |
.\aria2c --load-cookies=cookies.txt --input-file=links.txt --retry-wait=5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment