rewindBandcamp – Fetching artist details
fynngodau 於 5 年之前 修改了此頁面

Fetching band details is annoying through the web because there are so many different options artists can pick. Fortunatley, the "mobile" API is uniform and easy to use.

Simply do this POST query:

POST https://bandcamp.com/api/mobile/22/band_details

But what's that? You will receive this error message from the server:

{
    "error_message": "missing key band_id",
    "error": true
}

That's because you didn't specify a band whose information you would like to fetch! But not to worry, all you need to do is add a JSON body to your request:

{"band_id":"1196681540"}

And the server will give you JSON-structured information about your artist!

{
    "location": "UK",
    "bio_image_id": 16091056,
    "discography": [

        {
            "art_id": 2405652335,
            "artist_name": null,
            "title": "Home With Me",
            "release_date": "19 Dec 2018 00:00:00 GMT",
            "item_id": 3046965173,
            "item_type": "track",
            "is_purchasable": true,
            "band_id": 1196681540,
            "band_name": "mac benson"
        }, …

    ],
    "bio": "singer/writer",
    …
    "name": "mac benson",
    "id": 1196681540,
    …
    "shows": [],
    "header_image_id": null,
    "bandcamp_url": "http://macbenson.bandcamp.com"
}

Accessing images by id

These art_id values mean that you will have to access https://f4.bcbits.com/img/$id_$size.jpg to get the image. For track's art, you will have to add an a in front of your $id.

$size can be a lot of numbers, namely 0 (probably representing the original size) and others like 100 (which is some very narrow cutout).