Scraping the Bandcamp API
If you’re interested in listing your music on Bandcamp or seeing who’s already popular on there, you may be interested in scraping data from the Bandcamp search results pages for market research.
While Bandcamp does offer a Developer API, it requires approval and does not appear to allow querying of public data. It is instead intended for creators on the platform to query their own sales data.
However, we can still scrape the Bandcamp Web API that powers its website using a special technique involving HAR files. We will simply browse through the search results on Bandcamp as we record our web traffic to a HAR file, and then perform the scraping on the HAR file to pull the data out.
1. Browse Bandcamp Search Results
You can head to the Bandcamp Discover Page to begin searching through their content. You’ll see that by default it’s sorted by best sellers, so the top results should be doing well in recent sales.
You can apply any filters or tags you’d like, change the location, or even swap the sort order. Simply use the website normally until you see the search results show on the page that you’d like to scrape. Once you’re ready to scrape the data, right click on the web page and hit “Inspect” to begin recording your web traffic.
Now refresh the web page to force the Bandcamp API to reload the initial set of results to your browser since you’re now recording what it’s doing. Once loaded, you can proceed to scroll down through the results until you get through all of them or get bored, whichever comes first.
2. Export a HAR File
After scrolling through the results, go to the “Network” tab under developer tools and click the down arrow labeled “Export HAR…” to download a HAR file containing the raw JSON data we browsed through.
Upload that HAR file to the HAR File Web Scraper and look for the group labeled /api/discover/1/discover_web
(or similar) as shown above. It will combine together all of the API requests made to the search results endpoint and allow you to download the raw data.
3. Download Bandcamp Search Results
To download the search results as a CSV file, click the “Parse Group” button on the HAR file grouping and wait for the parse to finish. When complete, look for the results
collection which will let you download the search results.
While the search results don’t contain sales data, if you sorted by best sellers then the earlier results should be better sellers. You will see some useful columns as explained below:
- Listing ID
- Title
- Is Preorder?
- Is Free Download?
- Is Set Price?
- Item URL
- Price
- Price Currency
- Album Artist Name
- Band ID
- Band Name
- Band URL
- Band Genre ID
- Release Date
- Package Item Count
- Item Duration in Seconds
- Featured Track Title
- Playable Streaming URL
- Label Name
- Label URL