Giter Site home page Giter Site logo

bandcamp-scraper's Introduction

bandcamp-scraper

npm version TravisCI Status

Bandcamp Logo

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

Why ?

Because Bandcamp has shut down their public API and don't plan to reopen it.

https://bandcamp.com/developer

Installation

npm i --save bandcamp-scraper

Usage

search(params, callback)

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)

Search Results

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.

Example

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);
  }
});

View example with output.

getAlbumsWithTag(params, callback)

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)

Tag Results

An array of album information. Matches the tag-result JSON schema.

Example

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);
  }
});

View example with output.

getAlbumUrls(artistUrl, callback)

Retrieve the album URLs from an artist URL.

  • artistUrl String
  • callback Function(error, albumUrls)

Example

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);
  }
});

View example with output.

getAlbumProducts(albumUrl, callback)

Retrieves all the album's products from its URL.

  • albumUrl String
  • callback Function(error, albumProducts)

Album Products

An array of album products that matches the album-product JSON schema.

Example

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);
  }
});

View example with output.

getAlbumInfo(albumUrl, callback)

Retrieves the album's info from its URL.

  • albumUrl String
  • callback Function(error, albumInfo)

Album Info

An Object that represents the album's info. It matches the album-info JSON schema.

Example

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);
  }
});

View example with output.

Test

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

Contributing

Contribution is welcome! Open an issue first.

License

MIT.

bandcamp-scraper's People

Contributors

bonghead420 avatar mastert avatar mattbierner avatar maxp-hover avatar nukeop avatar soundofjw avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.