Skip to main content

Python library and CLI for Bandcamp data

Project description

bandcamp-explorer

A terminal browser and Python library for Bandcamp.

Search for artists and albums, discover releases by genre and location, browse artist/label profiles and discographies — all from the command line.

Install

Requires Python 3.12+.

Terminal CLI

uv tool install bandcamp-explorer
# or
pip install bandcamp-explorer

Discord bot

uv tool install bandcamp-explorer[discord]
# or
pip install bandcamp-explorer[discord]

Create a bot application at the Discord Developer Portal, enable the bot scope with Send Messages and Use Slash Commands permissions, then invite it to your server with the generated OAuth2 URL.

Set your bot token and run:

export DISCORD_TOKEN=your-bot-token
bandcamp-discord
# or with a .env file in the current directory
bandcamp-discord

Use --guild GUILD_ID to sync slash commands instantly to a specific server (global sync can take up to an hour).

Slash commands (all under /bandcamp):

Command Description
/bandcamp search <query> Search everything
/bandcamp album <query> Search albums
/bandcamp artist <query> Search artists/labels
/bandcamp track <query> Search tracks
/bandcamp discover <tag> Browse releases by tag (with optional slice and location filters)

Development

git clone https://github.com/gabriel-jung/bandcamp-explorer.git
cd bandcamp-explorer
uv sync

CLI

Search

bandcamp "caladan brood"                  # search everything
bandcamp "erang" --artist                 # artists/labels only
bandcamp "echoes of battle" --album       # albums only
bandcamp "a forest whisper" --track       # tracks only

Browse by tag

bandcamp --tag dungeon-synth                        # newest arrivals (default)
bandcamp --tag black-metal --top                    # best-selling
bandcamp --tag dungeon-synth --rand                 # surprise me
bandcamp --tag dungeon-synth --location france
bandcamp --tag dungeon-synth --location paris
bandcamp --tag dungeon-synth black-metal            # multi-tag

Slices: --new (default), --top, --rand.

Locations are resolved to geoname IDs via Bandcamp's autocomplete and cached locally; force a refresh with --refresh-location.

Direct URLs

bandcamp https://erang.bandcamp.com/album/tome-iv
bandcamp https://erang.bandcamp.com

Interactive navigation

After selecting a result, you enter an interactive browser:

  • Artists — view bio, browse discography, select an album to see its tracklist, select a track to view its page, navigate to the label.
  • Albums — header with tracklist, description, and lyrics; navigate to the artist/host page or select a track.

Press 0 to go back, Ctrl+C to quit.

Output modes

bandcamp "erang" --artist --json            # output as JSON
bandcamp --tag dungeon-synth --json --limit 100   # cap tag dump
bandcamp https://erang.bandcamp.com/album/tome-iv --json
bandcamp https://erang.bandcamp.com/album/tome-iv --full   # all sections at once
bandcamp -v ...                             # enable debug logging

Terminal images

Album covers and artist images render inline on terminals that support the iTerm2 or Kitty image protocol (iTerm2, Kitty, WezTerm, Mintty).

Library

The core module has no terminal dependencies — use it in scripts, pipelines, or other tools. All data is returned as plain dicts with a _type discriminator key.

from bandcamp_explorer.core import (
    BandcampClient, AlbumAPI, ArtistAPI, DiscoverWebAPI, SearchAPI,
    resolve_geoname,
)

with BandcampClient() as client:
    # Search
    results, has_more = SearchAPI(client).search("caladan brood", item_type="album")

    # Discover releases by tag (new discover_web endpoint)
    discover = DiscoverWebAPI(client)
    releases, cursor, total = discover.discover(tags=["dungeon-synth"], slice_="new")
    all_releases = discover.discover_all(tags=["dungeon-synth"], max_pages=3)

    # Fetch album details (skip cover-art bytes with fetch_art=False)
    album = AlbumAPI(client).get("https://erang.bandcamp.com/album/tome-iv")
    for track in album["tracks"]:
        print(f"  {track['position']}. {track['title']} ({track['duration']})")

    # Fetch artist/label profile
    artist = ArtistAPI(client).get("https://erang.bandcamp.com")
    for item in artist["discography"]:
        print(f"  {item['title']}")

    # Location filtering (geoname-based)
    geoname_id = resolve_geoname(client, "paris")
    releases, _, _ = discover.discover(tags=["dungeon-synth"], geoname_id=geoname_id)

    # Download images
    client.download_image(album.get("image_url"), output_dir="./images/")

The legacy DiscoverAPI (the older dig_deeper hub endpoint) and resolve_location (location-tag resolver) are still exported for callers that specifically need them, but DiscoverWebAPI returns a broader feed with richer inline fields (release_date, location, duration, price, …) and is the recommended entry point.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bandcamp_explorer-0.5.0.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bandcamp_explorer-0.5.0-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

Details for the file bandcamp_explorer-0.5.0.tar.gz.

File metadata

  • Download URL: bandcamp_explorer-0.5.0.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for bandcamp_explorer-0.5.0.tar.gz
Algorithm Hash digest
SHA256 898bbf0e0e9bc8071735461341bb34c34c626176fe9d4739e25974da9a5f0d1e
MD5 f23451d41b87e842d0e64e8ccfc7b013
BLAKE2b-256 bf1e05f5dde27166ecc5999346af25287cefdd6ba6acb8a164d5c1ef7b2957cb

See more details on using hashes here.

File details

Details for the file bandcamp_explorer-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: bandcamp_explorer-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 28.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for bandcamp_explorer-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c8ae42fe7643ca27f3d91fc9b1919b58d803dadb181da4248f75c998dde20b29
MD5 073119320a0bb1a0c9f1e562df67e1da
BLAKE2b-256 b8e8ec9bab31085135eda3e113eac64b433c80eaf034e33e0546147064e59cc2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page