Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including kingparsing with all npm packages installed. Try it out:

var kingparsing = require("kingparsing")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

kingparsing v1.0.0

Easy HTML wrapper

Easy Parsing

Easy HTML wrapper

Install

npm install kingparsing

Import

const parse = require("kingparsing")

Use

Get a sorted list of all html elements

This list is ordered by type of element.
return a JSON Object.

parse("http://www.google.com")
    .then(console.log)
    .catch(console.error)

Get a list of items that contain this attribute

This list contains any type of element.
return an Array

parse.getByAttributes("http://www.google.com",{id:'lga'})
    .then(console.log)
    .catch(console.error)

Get a list of items that contain a specific content

This list contains any type of element.
return an Array

parse.getByContent("http://www.google.com","search")
    .then(console.log)
    .catch(console.error)

Appearances

Here is the appearance that the HTML element objects will have.

{
    "type" : "type of html element",
    "match" : "body of html element",
    "content" : "content of html element",
    "attributes" : {
        "attribute1 name" : "attribute1 value",
        "attribute2 name" : "attribute2 value"
    }
}

Thanks

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free