Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dom-goggles

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-goggles

Look up keywords & their frequence over a list of pages

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

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.

Keywords

FAQs

Package last updated on 01 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc