@stefcud/fetch-dom

1.3.5 • Public • Published

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);

});

Package Sidebar

Install

npm i @stefcud/fetch-dom

Weekly Downloads

0

Version

1.3.5

License

MIT

Unpacked Size

8.61 kB

Total Files

8

Last publish

Collaborators

  • stefcud