0.1.0-alpha.2 • Published 5 years ago

plk v0.1.0-alpha.2

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

Pluck (plk)

Query over your scrapped html with native js query syntax simply using plk.byQuery('div.content')

Umm.. You're too early D:

This is not ready to be used yet. You can contact me on my twitter@saurabhcodes for any help with contributions.

Usage

plk.byQuery(cssQuery, htmlContent);

Example

const plk = require('plk');
const html = `<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
  </head>
  <body>
    <div class="content">
      <div class="blue">
        <p>This is some paragraph inside div tag.</p>
      </div>
      <div class="green">
        <p>This is some paragraph inside mewdiv tag.</p>
      </div>
    </div>
  </body>
</html>`;

console.log(plk.byQuery('p',html));

Outputs:

[ 'This is some paragraph inside div tag.', 'This is some paragraph inside mewdiv tag.' ]