@nire0510/jdom
v1.0.3
Published
Transform web pages DOM to JSON and query it with JMESPath
Downloads
53
Maintainers
Readme
jsdom
Transform web pages DOM to JSON and query it with JMESPath.
Installation
npm i @nire0510/jdom
Usage
import jdom from '@nire0510/jdom';
const output = await jdom(params);
console.log(output, null, 2);
params
{
jmespath?: string | { [key: string]: string },;
timeout?: number;
url: string;
viewport?: {
width: number;
height: number;
};
waitForSelector?: string;
waitUntil: 'load' | 'domcontentloaded' | 'networkidle0' | 'networkidle2';
}
jmespath
(string | object, optional) - The jmespath filter to apply on the DOM before returning the output. It could be either a single string filter or a dictionary of filters, e.g.{ jmespath: { rooms: '[]...', employees: '[]...', } }
timeout
(number, optional) - The timeout in milliseconds after which the script should fail.url
(string, mandarory) - The URL of the web page from which you want to extract its DOM.viewport
(object, optional) - The dimensions of the browser.waitForSelector
(string, optional) - The selector of an element to wait for before running extracting the web page DOM.waitUntil
(string, optional) - Waits for a specific event in the web page's life cycle before running extracting the web page DOM.