HTML Parser

This project is a tool for providing HTML parsing via a RESTful API endpoint.
Prerequisites
CLI Tools
Example
API Request
const url = 'https://.../v1/html-parser';
const body = {
html: '<html>...</html>',
properties: [
{
name: 'title',
selector: '.product .title',
},
{
name: 'details',
selector: '.product .details ul li',
},
{
name: 'image',
selector: '.product img',
attribute: 'src',
},
],
};
const options = {
method: 'POST',
body: JSON.stringify(body),
};
return fetch(url, options)
.then((response) => response.json())
.catch((e) => console.log(e));
Successful Response
{
"title": [
"Men's Columbia Flattop Ridge Fleece Jacket"
],
"image": [
"https://....com/images/clothing/2599191_ALT-1000.jpg"
],
"details": [
"Polyester fleece",
"Machine wash",
"Imported",
],
}
Failure Response
{
"error": "no properties found"
}