Skip to main content

Search for items on bandcamp

Project description

bandcamp-search

Library to search for music on Bandcamp.

Installation

pip install bandcamp-search

Usage

Sample usage is in bandcamp_search/__main__.py:

import sys
from typing import cast

from bandcamp_search.search import search
from bandcamp_search.models import (
    AlbumSearchResult,
    ArtistLabelSearchResult,
    SearchType,
    TrackSearchResult,
)

if __name__ == "__main__":
    query = sys.argv[1]
    results = search(query, SearchType.ALL)
    for result in results["auto"]["results"]:
        if result["type"] == SearchType.ALBUMS:
            result = cast(AlbumSearchResult, result)
            print(f"Album: {result['name']}")
            print(f"  by {result['band_name']}")
            print(f"  buy at {result['item_url_path']}")
        if result["type"] == SearchType.ARTISTS_AND_LABELS:
            result = cast(ArtistLabelSearchResult, result)
            print("Artist/Label: {result['name']}")
            print(f"  {result['location']}")
        if result["type"] == SearchType.TRACKS:
            result = cast(TrackSearchResult, result)
            print(f"Track: {result['name']}")
            print(f"  on {result['album_name']} by {result['band_name']}")
            print(f"  listen at {result['item_url_path']}")

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_search-0.1.0.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

bandcamp_search-0.1.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file bandcamp_search-0.1.0.tar.gz.

File metadata

  • Download URL: bandcamp_search-0.1.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Linux/5.15.0-112-generic

File hashes

Hashes for bandcamp_search-0.1.0.tar.gz
Algorithm Hash digest
SHA256 de289b9ec4170796b41d84a0104d2e31a783c880204ad82f5bc23c0142ce6148
MD5 51151b48df6bd3a5f2f9d10cba5bf5d6
BLAKE2b-256 20e6c186e69acdb7eb72687d1d24c46d7c7bd15c2a3a4d4d62ac9398d98da937

See more details on using hashes here.

File details

Details for the file bandcamp_search-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bandcamp_search-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Linux/5.15.0-112-generic

File hashes

Hashes for bandcamp_search-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ef0acb80ca56bee76aaa25c48c342ae8a6cbf526b86c2c5cdc94c3561ef9e3a
MD5 edabd957670829f568095cf230e5c968
BLAKE2b-256 12de65c92c9871ddde1a200f19636388da4ba8f56643afeecf787372f0ac5d95

See more details on using hashes here.

Supported by

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