It is a scraper for bandcamp.com that allows you to:
- search anything (artist, album, track, fan) by keywords
- get all album URLs from an artist URL
- get all products from an album URL
Because the Bandcamp's API is no longer supported and Bandcamp is not granting any new developer keys.
https://bandcamp.com/developer
npm install bandcamp-scraper
Require library
var bandcamp = require('bandcamp-scraper');
bandcamp.search({
query: 'Coeur de pirate',
page: 1
}, function(error, results) {
if (error) {
console.log(error);
} else {
console.log(results);
}
});
- query: keywords (required)
- page: results page (default: 1)
An array of Object that have different properties depending on the type.
-
artist
- type: String
- name: String
- link: String
- image: String
- tags: Array
- genre: String
- from: String
-
album
- type: String
- name: String
- link: String
- image: String
- tags: Array
- releaseDate: String
- artist: String
- numTracks: Integer
- numMinutes: Integer
-
track
- type: String
- name: String
- link: String
- image: String
- tags: Array
- releaseDate: String
- album: String
- artist: String
-
fan
- type: String
- name: String
- link: String
- image: String
- tags: Array
- genre: String
var artistURL = "http://musique.coeurdepirate.com/";
bandcamp.getArtistAlbumURLs(artistURL, function(error, results) {
if (error) {
console.log(error);
} else {
console.log(results);
}
});
An array of URL for each album of the artist.
var albumURL = "http://musique.coeurdepirate.com/album/blonde";
bandcamp.getAlbumProducts(albumURL, function(error, results) {
if (error) {
console.log(error);
} else {
console.log(results);
}
});
An array of URL of Object that represent a product related to the album.
Product properties
- link: String
- images: Array of String
- name: String
- description: String
- format: String
- priceInCents: Integer
- currency: String (3 letters)
- nameYourPrice: Boolean
- orMore: Boolean
- soldOut: Boolean
- numRemaining: Integer (null if there is no remaning count)
TODO: write some tests and better doc.
Contribution is welcome! Open an issue first.
MIT.