plk

Query over your scrapped html with native document.querySelector() syntax

Usage no npm install needed!

<script type="module">
  import plk from 'https://cdn.skypack.dev/plk';
</script>

README

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.' ]