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.
const scrapper = require('scrape-web');
scrapper({
url: 'https://www.nytimes.com/',
elementToScrape: 'article .title',
})
.then(data => console.log(data))
.catch(err => console.log(err));
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',
},
];
This package is published under the terms of the MIT License.