Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

archambault-scraper

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

archambault-scraper

A scraper for http://www.archambault.ca.

  • 0.2.1
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

archambault-scraper

A scraper for http://www.archambault.ca

npm version Build Status Dependency Status

install

Using NPM:

npm i --save archambault-scraper

usage

var archambault = require('archambault-scraper');

var query = {
  query: 'Radiohead',
  category: 'Music',
  searchByArtist: true,
  sortBy: 'Relevance',
  order: 'Desc',
  limit: 10,
  page: 1
};

archambault.search(query, function(error, products) {  
  if (error) {
    console.log(error);
  }
  if (products) {
    console.log(products);
  }
});

documentation

ValidationError

Error instance with additional Object property errorObjects which content all the error information, see ajv error.

ListValidationError

Error instance with additional Array property validationError of ValidationError instance.

search(params, callback)

Search products on the Archambault online store. Each products are validate against the product JSON schema.

params

An Object with the following properties:

params.query

Type: String required

What you search.

params.category

Type: String required

One of the following:

  • Sheet Music
  • E-Books
  • Music
  • Videos and TV Shows
  • Books
  • Instruments
  • Toys & Games
  • Gifts and Stationary
params.searchByArtist

Type: Boolean, default: false

Specify that the query is the "artist" name (musician, producer, writer, etc.).

params.sortBy

Type: String, default: Relevance

One of the following:

  • Relevance
  • Popularity
  • Title
  • Released
  • Price
params.order

Type: String, default: Asc

One of the following:

  • Asc
  • Desc
params.limit

Type: Integer

Number of products per page.

params.page

Type: Integer

Index of the page.

callback(error, products)

The products contains the valid products. If there is validation error, error will be a ListValidationError, but there might still be valid products.

 function callback(error, products) {
  if (error) {
    console.log(error.message);
    if (error instanceof ListValidationError) {
      // List all the validation messages
      for (var i = 0; i < error.validationErrors.length; i++) {
        console.log(error.validationErrors[i].message);
      }
    }
  }
  console.log('Number valid products:', products.length);
  console.log(products);
}

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

dependecies

dev dependecies

  • jasmine - DOM-less simple JavaScript testing framework.

license

MIT.

Keywords

FAQs

Package last updated on 03 Feb 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc