Skip to content

Releases: masterT/yolo-scraper

v0.2.0

03 Feb 14:41
Compare
Choose a tag to compare

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.

options.paramsSchema

The JSON schema that defines the shape of the accepted arguments passed to options.request. When invalid, an Error will be thrown.

Optional

options.validateList

Use this option to validate each item of the data extracted individually. When true, the data extracted is required to be an Array, otherwise an Error is returned in callback.

Optional, default: false

scraper function callback(error, data)

  • When a network request error occurred, the callback error argument will be an Error and the data will be null.
  • When options.validateList = false and a validation error occurred, error will be a ValidationError and the data will be null. Otherwise, the error will be null and data will be the returned value of options.extract.
  • When options.validateList = true and a validation errors occurred, error will be a ListValidationError, otherwise it will be null. If the value returned by options.extract is not an Array, error will be an instance of Error. The data always be an Array that only contains the valid item returned by options.extract. It's not because error is a ListValidationError that there will be no data!