Skip to content

Magic utility that extract javascript global variables from a remote html page.

License

Notifications You must be signed in to change notification settings

stefanocudini/node-fetch-dom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fetch-dom

Magic utility that extract javascript global variables from a remote html page.

npm version

Licensed under the MIT license.

Copyright Stefano Cudini

Source code

Github NPM

Usage

Install in command line

$ npm install -g @stefcud/fetch-dom

run command parameters is a url page and a global variable name

$ fetchdom https://opengeo.tech/index.html allTags

the output is a json

html in remote page

<script>
var allTags = {"ajax":0,"bash":0,"bootstrap":0,"crawler":0,"css3":0,"cv":0,"debian":0,"developer":0,"dom":0,"fetch":0,"geojson":0,"geosocial":0,"gis":0,"gps":0,"gpx":0,"gruntjs":0, .... 
</script>

Usage

$ npm install --save fetch-dom 

Integrate in your code

var fetchdom = require('@stefcud/fetch-dom');

/*
  by default return the window object
*/
fetchdom('https://opengeo.tech/', function(window) {

	console.log(window.document.body);
});

/*
  specify sub property of default DOM
*/
fetchdom('https://opengeo.tech/', 'location.href', function(href) {

	console.log(href);

});

/*
  parsing of global remote variables (in remote page is defined window.allTags = {...}; )
*/
fetchdom('https://opengeo.tech/', 'allTags', function(tags) {

	console.log(tags);

});

About

Magic utility that extract javascript global variables from a remote html page.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published