raspar

3.0.2 • Public • Published

raspar

A simple to use Promise-based web scraper with local caching.

Tests NPM Version Latest Documentation

Usage

const { fetch } = require('raspar');

fetch('http://www.google.com/humans.txt').then(content => console.log(content));
const { fetch } = require('raspar');

fetch([
  'http://www.google.com/humans.txt',
  'http://www.google.com/robots.txt'
]).then(content => console.log(content[0]));

Options

const { fetch } = require('raspar');

const options = {
  cacheDirectory: 'temp/cache/',
  requestOptions: {
    headers: {
      'User-Agent': 'request'
    },
    method: 'POST'
  },
  ttl: 1800
};

fetch('http://www.google.com/humans.txt', options).then(content =>
  console.log(content)
);
Name Description Default Value
cacheDirectory Directory to store cache. temp/cache/
requestOptions Request options object. Read more github.com/node-fetch/node-fetch {}
ttl TTL (Time to live) in seconds. 1800

Readme

Keywords

Package Sidebar

Install

npm i raspar

Weekly Downloads

0

Version

3.0.2

License

MIT

Unpacked Size

15.5 kB

Total Files

12

Last publish

Collaborators

  • neogeek