Performs many parsing operations against one HTML string.
Performs many parsing operations against one HTML string. This transforms the HTML into a DOM only once instead of for each filter in the dictionary, which can quickly get expensive in terms of processing. This also allows you to break your filters up into more granular components and mix and match them as you please.
The values in the dictionary can be htmlToJson.Parser objects, generated methods from htmlToJson.createMethod, or naked filters that you might normally pass into htmlToJson.parse.
the HTML string
a dictionary containing the elements to be processed
the optional callback
a promise
htmlToJson.batch(html, dictionary, [callback]) -> promise
Generates a method that wraps the passed filter argument.
Generates a method that wraps the passed filter argument. The generated method takes an HTML string and processes it against that filter.
the given filter array
htmlToJson.createMethod(filter) -> function (html, [callback])
For the sake of reusability, creates an object with .parse and .request helper methods, which use the passed filter.
For the sake of reusability, creates an object with .parse and .request helper methods, which use the passed filter.
the given filter array
a promise
new htmlToJson.Parser(filter)
htmlToJson.createParser(filter)
The parse() method takes a string of HTML, and a filter, and responds with the filtered data.
The parse() method takes a string of HTML, and a filter, and responds with the filtered data. This supports both callbacks and promises.
htmlToJson.parse(html, filter, [callback]) -> promise
The request() method takes options for a call to the request library and a filter, then returns the filtered response body.
The request() method takes options for a call to the request library and a filter, then returns the filtered response body.
htmlToJson.request(requestOptions, filter, [callback]) -> promise
Html-to-Json Companion