About
SoupJS is a JavaScript library built for simple web scraping.
Installation
To install using npm
, run:
npm i soupjs-lib
Usage
Here’s a basic example of using SoupJS:
const soupjs = require("soupjs-lib");
soupjs.scrape(url).then(res => {
// Search for HTMl elements belonging to CSS selector
let pTags = res.findAll("p");
console.log(pTags);
/*
=> [ Tag {
tag: 'p',
text: 'text',
attrs: {'class': ['foo', 'bar', 'baz'], ...},
htmlContent: 'some text',
document: HTMLHtmlElement {}
}, ...]
*/
}).catch(err => console.log(err));
For more information on using SoupJS, check out the quick start tutorial or the documentation.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/jianmin-chen/soupjs. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The theme is available as open source under the terms of the MIT License.