New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

sgrape

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

sgrape

Build and maintain simple webscrapers easily.

latest
Source
npmnpm
Version
0.1.6
Version published
Weekly downloads
10
900%
Maintainers
1
Weekly downloads
 
Created
Source

Sgrape 🍇

Build and maintain simple webscrapers easily.

Install


$ npm i sgrape

Usage


const Sgrape = require('sgrape');

const schema = {
  startPage: 'https://www.website.com/page',
  selector: '.element-selector',
  nextPageSelector: '.page-link[rel=next]', // optional
  title: { selector: 'h1', attr: 'text' },
  link: { selector: 'a.title', attr: 'href' },
  desc: { selector: 'p.desc', attr: 'text' },
};

// per field helpers (optional)
const helpers = {
  title: title => title.replace('/', ' '),
  desc : desc => desc.substr(0,30) + '...'
};

const scraperConfig = { schema, helpers };

// executes once job finished.
scraperConfig.done = res => {
  // insert res to db or whatever
  console.log(res);
};

const scraper = new Sgrape(scraperConfig);

Versioning

Sgrape uses SemVer for versioning.

License

This project is licensed under the MIT License

Keywords

scraper

FAQs

Package last updated on 10 Jan 2020

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