A pluggable, simple and powerful web scraper.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
src
test
.babelrc
.eslintignore
.eslintrc
.gitignore
.npmignore
.travis.yml
contributing.md
package.json
readme.md

readme.md

Tatooine: A pluggable, simple and powerful web scraper.

Dependency Status Build Status Coverage Status

Installation

$ npm install tatooine --save

Examples

Documentation

const tatooine = new Tatooine(sources (Array of Objects), callback (Function), options (Object));

[required] sources

Look for the Default Schemas and Custom Schemas sections to learn what you can add here.

[required] callback

Return an array with the responses

[optional] options

An object thats allow configure Tatooine to accept the following options:

schemas: An array of objects that allow you plug and play with new schemas beyond of the schemas provided by Tatooine.

Default Schemas

Tatooine comes for you with three default schemas ready to use and they can be used with this instructions:

Custom Schemas

Beyond of the schemas provided by default, you can create and plugin schemas with yours specific rules. Basically, you should follow this way to extend Tatooine and use this feature:

// yourschema.js
export default {
  type: 'yourschema', // [required] This will connect your custom schema with you custom source.
  schema(body, source) { // [required] [parameters: body and source] Here you'll be able to create the logic of your schema.
    let results = [];

    // Your rules

    return results; // [required] It should return an array of objects with the results
  }
};
// yoursource.js
export default {
  type: 'yourschema', // [required] It will connect your custom schema with you custom source.
  requestOptions: { // [required] This field accept all options of "request" module. (e.g. https://www.npmjs.com/package/request)
    url: 'https://urltoconsume.com/'
  }
};

To understand and for a easy usage of this feature is highly recommended look for the code of this example.

BONUS: Usage of Tatooine inside of an old project

If you are using the old ES5 syntax in your project, use this declaration to inject Tatooine as a dependency:

var Tatooine = require('tatooine').default;

License

The MIT License (MIT)

Copyright (c) 2016 Beto Muniz (http://betomuniz.com/)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.