나는 npm install node-phantom
에 의해 노드 팬텀를 설치했지만이 코드를 실행하고 할 때,이 오류를PhantomJS와 함께 node.js를 사용하여 스크래핑하는 방법?
var webpage = require('webpage').create(),
url = "https://www.example.com/cba/abc",
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();
}
});
웹 페이지 모듈이 있는지 여부를 node_module 폴더에서 확인하십시오. –