jeudi 29 janvier 2015

How to use phantomjs along with node.js for scrapping


I have installed node-phantom by npm install node-phantom but when I am running this code, it is giving Cannot find module 'webpage' this error



var webpage=require('webpage').create(),
url="http://ift.tt/15Xel71",
hrefs= new Array();
webpage.open(url,function(status){
if(status=="success"){
var results = page.evaluate(function(){
$("#endpoints").each(function() {
hrefs.push($(this).attr("href"));
});
return hrefs;
});
console.log(JSON.stringify(results));
phantom.exit();
}
});


Can anyone help me out with this problem





Aucun commentaire:

Enregistrer un commentaire