bandcamp

package
v1.34.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2021 License: OSL-3.0 Imports: 7 Imported by: 1

README

Bandcamp

Date: Fri, 17 Sep 2021 21:31:29 +0000
From: Bandcamp Support <support@bandcamp.com>
Subject: Re: (Case 1268890) API Access

Thanks for your interest. Our APIs are currently limited to Label Accounts
(bandcamp.com/labels) looking to pull physical order and general sales
information, though that might change down the road. Please keep an eye on
bandcamp.com/developer for updates.

Resolve

I found a workaround for this. You can make a request like this:

HEAD /track/amaris-2 HTTP/1.1
Host: schnaussandmunk.bandcamp.com

and in the response should be this:

Set-Cookie: session=1 r:["nilZ0t2809477874x1633448962"]	t:1633448962; domain=.bandcamp.com; path=/; expires=Fri, 19 Nov 2021 15:49:22 -0000

In this case, t is the tralbum_type and 2809477874 is the tralbum_id. You can then try a request like this:

http://bandcamp.com/api/mobile/24/tralbum_details?tralbum_type=t&tralbum_id=2809477874

which will return error:

{"error_message":"band_id required","error":true}

You can fix it by just adding band_id=1:

http://bandcamp.com/api/mobile/24/tralbum_details?band_id=1&tralbum_type=t&tralbum_id=2809477874

Documentation

Index

Constants

View Source
const (
	ApiAlbum  = "http://bandcamp.com/api/album/2/info"
	ApiBand   = "http://bandcamp.com/api/band/1/info"
	ApiMobile = "http://bandcamp.com/api/mobile/24/tralbum_details"
	ApiTrack  = "http://bandcamp.com/api/track/3/info"
	ApiUrl    = "http://bandcamp.com/api/url/2/info"
)

Variables

View Source
var Heights = map[int]int{
	100:  3,
	124:  8,
	135:  15,
	138:  12,
	150:  7,
	172:  11,
	210:  9,
	300:  4,
	350:  2,
	368:  14,
	380:  13,
	700:  5,
	1200: 10,
	1500: 1,
}
View Source
var Verbose = mech.Verbose

Functions

func ArtUrl added in v1.33.4

func ArtUrl(id, height int) string
func Head(addr string) (byte, int, error)

URL to track_id or album_id, anonymous

Types

type Album

type Album struct {
	Large_Art_URL string // 350 x 350
	Release_Date  int64
}

func NewAlbum added in v1.33.4

func NewAlbum(id int) (*Album, error)

func (Album) Unix added in v1.33.4

func (a Album) Unix() time.Time

type Band added in v1.29.5

type Band struct {
	Name string
	URL  string
}

func NewBand added in v1.33.6

func NewBand(id int) (*Band, error)

type Info added in v1.33.4

type Info struct {
	Album_ID int
	Band_ID  int
	Track_ID int
}

func NewInfo added in v1.33.4

func NewInfo(addr string) (*Info, error)

URL to track_id, album_id or band_id, key

type Track added in v1.33.4

type Track struct {
	Album_ID      int
	Streaming_URL string
	Title         string
}

func NewTrack added in v1.33.4

func NewTrack(id int) (*Track, error)

type Tralbum added in v1.33.3

type Tralbum struct {
	Art_ID       int
	Release_Date int64
	Title        string
	Tracks       []struct {
		Streaming_URL struct {
			MP3_128 string `json:"mp3-128"`
		}
	}
	Tralbum_Artist string
}

All fields available with Track and Album

func NewTralbum added in v1.33.4

func NewTralbum(typ byte, id int) (*Tralbum, error)

func (Tralbum) Unix added in v1.33.4

func (t Tralbum) Unix() time.Time

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL