dom-goggles
Look up keywords & their frequence over a list of pages
Last updated 3 years ago by walaura .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install dom-goggles 
SYNC missed versions from official npm registry.

dom-goggles

What an adorable name, isn't it? i'm kind of proud of it myself. ANYWAY. This tool basically takes an array of websites, an array of strings to look up and will tell you to the best of its skills (it uses phantomjs so modern javascript might break this poor thing) how many times each one appears, per webpage and total

Install & Usage

npm install dom-goggles

& then

import domGoggles from 'dom-goggles'
domGoggles(
    ['http://facebook.com','http://youtube.com','http://yahoo.com'],
    ['<div'],
    {report: true}
).then(results => {
    console.log(results);
}).catch(e => {
    console.error(e);
})

Okay but why would i want this

Not for much really (unless you are like VERY into counting things. No judgement there). You can, for example, use it to scan the dom on pages you serve to find the most common web components & load those into the main app bundle, leaving the rest as chunks on demand.

I mean you might think this is overkill and there's probably better ways to do this but if you are plugging this directly into a php monolyth it's actually like the lightest way? I tried grepping the templates folder first, that actually took longer.

Let me know if this helped you! PR's for deeper DOM introspection (such as having queryselectorAll or any js really in addition to regex) are EXTREMELY welcome, I just didn't have the need for its particular usage.

Current Tags

  • 1.0.7                                ...           latest (3 years ago)

8 Versions

  • 1.0.7                                ...           3 years ago
  • 1.0.6                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (2)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 6
Dependencies (3)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |