Scraping the Discogs API
If you’re looking for the most complete database of every music album ever released, it’s hard to beat the data quality behind Discogs, which has over 15,000,000 releases in its database. In addition to offering music consumers a collection wantlist for music they want, Discogs also offers a robust API for businesses and app developers to use for downloading historical data in the music industry.
Discogs API Access Token
In order to use the Discogs API, you’ll need to register for an account and then generate a user token. Once you have an account, you can navigate to your Discogs Developer Settings and click Generate new token
to get an API token:
This is all you need to access data from the Discogs API & Database Search. You don’t need to worry about a consumer key and secret unless you want to have other users log in to your app, which we won’t cover here.
Database Search API
The most useful endpoint of the Discogs API for scraping data will be the Database Search Endpoint, allowing you to find releases based on a number of search parameters like barcode, artist, year, free text, catalog number, and more! You can also use the Discogs Database Search Endpoint to quickly export this data as CSV files for analysis on your own.
The response will contain the search results, and each result will contain a resource url
and release id
we’ll need to look up more information for each release. We can see one of the sample search results looks as follows:
{
"title": "Nirvana - Nevermind",
"country": "Australia",
"uri": "/Nirvana-Nevermind-Classic-Albums/release/2028757",
"catno": "RV0296",
"year": "2005",
"genre": [
"Non-Music",
"Rock"
],
"resource_url": "http://api.discogs.com/releases/2028757",
"type": "release",
"id": 2028757
}
You will see the individual release ID under the id
field, or in this case 2028757
. We can then pass this ID into the Discogs Release Details Endpoint to find much more information about the release, including several links to images, lots more documentation, related artists and more! You’ll also notice a master_id
in the response, which will correspond to a master release that contains all related individual releases.
Master Release
You can then take the master release ID and feed it to the Discogs Master Release Details Endpoint and get back data about all the releases, including similar releases to get a complete picture of the album’s release around the world.
Artist Releases
If you’re more interested in tracking an individual artist, you can see the Discogs Artist Releases Endpoint which lets you specify an artist you want to scrape the release history for.
Scrape Discogs With Us!
While you’re welcome to review the direct Discogs API above, our service can make it much easier to download this data from their API into CSV files without any code. Just check out the links on this page and reach out to support here if you need us to add any additional functionality around the Discogs API (e.g. scrape all the releases for an artist).