A scraper for https://bandcamp.com
The scraper allows you to:
- search
artist
,album
,track
,fan
,label
- get album urls from an artist url
- get album info from an album url
- get album products from an album url
Because Bandcamp has shut down their public API and don't plan to reopen it.
https://bandcamp.com/developer
npm i --save bandcamp-scraper
Search any resources that match the given params.query
for the current params.page
.
- params Object
- query String
- page Integer (default
1
)
- callback Function(error, searchResults)
An array of resources that have different properties depending on their type property: artist, album, track, fan, or label.
Every resource matches the search-result JSON schema.
var bandcamp = require('bandcamp-scraper');
var params = {
query: 'Coeur de pirate',
page: 1
};
bandcamp.search(params, function(error, searchResults) {
if (error) {
console.log(error);
} else {
console.log(searchResults);
}
});
Search for albums with the tag params.tag
for the current params.page
.
- params Object
- tag String
- page Integer (default
1
)
- callback Function(error, tagResults)
An array of album information. Matches the tag-result JSON schema.
var bandcamp = require('bandcamp-scraper');
var params = {
tag: 'nuwrld',
page: 1
};
bandcamp.getAlbumsWithTag(params, function(error, tagResults) {
if (error) {
console.log(error);
} else {
console.log(tagResults);
}
});
Retrieve the album URLs from an artist URL.
- artistUrl String
- callback Function(error, albumUrls)
var bandcamp = require('bandcamp-scraper');
var artistUrl = 'http://musique.coeurdepirate.com/';
bandcamp.getAlbumUrls(artistUrl, function(error, albumUrls) {
if (error) {
console.log(error);
} else {
console.log(albumUrls);
}
});
Retrieves all the album's products from its URL.
- albumUrl String
- callback Function(error, albumProducts)
An array of album products that matches the album-product JSON schema.
var bandcamp = require('bandcamp-scraper');
var albumUrl = 'http://musique.coeurdepirate.com/album/blonde';
bandcamp.getAlbumProducts(albumUrl, function(error, albumProducts) {
if (error) {
console.log(error);
} else {
console.log(albumProducts);
}
});
Retrieves the album's info from its URL.
- albumUrl String
- callback Function(error, albumInfo)
An Object that represents the album's info. It matches the album-info JSON schema.
var bandcamp = require('bandcamp-scraper');
var albumUrl = 'http://musique.coeurdepirate.com/album/blonde';
bandcamp.getAlbumInfo(albumUrl, function(error, albumInfo) {
if (error) {
console.log(error);
} else {
console.log(albumInfo);
}
});
Feature tests are run daily, thank to Travis Ci new feature CRON Jobs. This way we know if the scraper is ever broken.
Run the test:
npm test
Contribution is welcome! Open an issue first.
MIT.