1.3.5 • Published 2 years ago

@stefcud/fetch-dom v1.3.5

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

fetch-dom

Library for Nodejs that retrieve the DOM and global vars 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);

});
1.3.5

2 years ago

1.3.4

3 years ago

1.3.3

5 years ago

1.3.2

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago