Bookmarklets & Bandcamp

2022-08-14

I recently learnt about bookmarklets, a neat bookmarking feature that lets you execute JS with a click! Coincidentally, I also had to download my Bandcamp library — a uniquely annoying experience. One use I've found is getting the download links from my Bandcamp library, ready to be fed into a command-line downloader.

I already had a Github gist that I was running from developer tools, so now all I have to do is turn this into a bookmarklet to get a quicker and more user-friendly tool.

javascript:(function() {
    var urls = document.getElementsByClassName("item-link");
    var string = "";
    for (var url of urls) {
        if (url.href) {
            string += url + "\n";
        }
    }
    alert(string);
})()

Take that code and save it as the URL of a bookmark. Now go to your Bandcamp library and open the bookmark: you'll get an alert containing your links ready to go! By default Bandcamp only loads the first 20 purchases, so you may need to scroll down and click some buttons to get every purchase.