scrape-js

Easy, robust, and straightforward web scraper

Usage no npm install needed!

<script type="module">
  import scrapeJs from 'https://cdn.skypack.dev/scrape-js';
</script>

README

scrape-js

An easy, robust, and straightforward web scraper with multifunctional uses.

Installation

npm install scrape-js

Example

The following code scrapes the Hacker News website and prints the first 30 titles found on the page.

var scrape = require('scrape-js')
scrape('news.ycombinator.com', ['.title a'], function (error, titles) {
    if(error) throw error;
    console.log('hacker news titles\n');
    titles.forEach(function (element, idx) {
        console.log('  %d. %s', idx+1, element.html());
    });
});