javascript - how to get a document object from a given url in node js -
how can using node.js api document of given url work with. here snippet of come :
var needhttp = require('http'); var getallfromsite = function ( siteurl, tag) { var requesttourl = needhttp.get( siteurl, function (responsefromurl) { responsefromurl. somehowgetdocument... }); }
so far i've found this, still needs domparser could't find:
function getsourceasdom(url) { xmlhttp=new xmlhttprequest(); xmlhttp.open("get",url,false); xmlhttp.send(); parser=new domparser(); return parser.parsefromstring(xmlhttp.responsetext,"text/html"); }
Comments
Post a Comment