【发布时间】:2015-09-25 11:00:08
【问题描述】:
我使用在 https://www.npmjs.com/package/crawler-ninja 找到的 Crawler Ninja 插件和插件过期域。 https://github.com/christophebe/expired-domains.ninja
但是,在我第一次“尝试”时,它返回了一些模糊的错误。 第一个是我相信的错字,我改了
console.log(ed.expireds.keys())
到
console.log(end.expireds.keys())
错误是:
console.log(ed.expireds.keys())
^
ReferenceError: ed is not defined
现在我面临一个新错误:
[root@vps-121706-2576 node_modules]# node ttt.js
Use log in : /root/plg/node_modules/logs/crawler.log
Well done Sir !, done in : 170389
/root/plg/node_modules/ttt.js:22
console.log(end.expireds.keys())
^
TypeError: Cannot call method 'keys' of undefined
问题:
不了解错误以及如何修复它。 如果需要更多信息或细节,请发表评论。
代码插件:
var crawler = require("crawler-ninja");
var ep = require("crawler-ninja-expired");
crawl();
function crawl(){
var c = new crawler.Crawler({
externalDomains : true,
images : false,
scripts : false,
links : false, //link tags used for css, canonical, ...
followRedirect : true
});
var expired = new ep.Plugin(c);
c.on("end", function() {
var end = new Date();
console.log("Well done Sir !, done in : " + (end - start));
// the attributes expireds is a map with a key that match to the expired domains
console.log(end.expireds.keys())
});
var start = new Date();
c.queue({url : "http://www.erijane.nl/"});
}
【问题讨论】:
-
为什么是 -1 ?我试图正确地构造问题和代码。至少当你 -1 解释原因时..
标签: javascript node.js web-crawler