0.0.2 • Published 5 years ago

scrape-web v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

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.