scrape-web

0.0.2 • Public • Published

Scrapper

A plug-n-play scrapper for Node.js

I keep writing the same code again and again. So, thought of publishing it as a package.

usage

const scrapper = require('scrape-web');
 
scrapper({
  url: 'https://www.nytimes.com/',
  elementToScrape: 'article .title',
})
  .then(data => console.log(data))
  .catch(err => console.log(err));

With async/await

const scrapper = require('scrape-web');
 
(async () => {
  try {
    const result = await scrapper({
      url: 'https://www.nytimes.com/',
      elementToScrape: 'article .title',
    });
 
    console.log(result);
  } catch (err) {
    console.log(err);
  }
})();

Return an array of Objects

[
  {
    href: '/some/url/location.html',
    textContent: `Returns null if there's no textContent`,
    src: 'applicaple in tags like img',
  },
];

License

This package is published under the terms of the MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i scrape-web

Weekly Downloads

1

Version

0.0.2

License

MIT

Unpacked Size

3.1 kB

Total Files

4

Last publish

Collaborators

  • thisisabdus