amoilanen / js-crawler

Web crawler for Node.JS
MIT License
253 stars 55 forks source link

path in variable #41

Closed Muneem closed 7 years ago

Muneem commented 7 years ago

if i set path in variablle then crawler function is not working

like var path=process,env.path

var Crawler = require("js-crawler");

new Crawler().configure({depth: 3}) .crawl(path, function onSuccess(page) { console.log(page.url); });

amoilanen commented 7 years ago

Is the variable path set? Probably also the crawler should check better for when the path is not defined and report it clearly. Looks like now it is not the case.

var path=process,env.path

var Crawler = require("js-crawler");

console.log('path = ', path);

new Crawler().configure({depth: 3})
.crawl(path, function onSuccess(page) {
console.log(page.url);
});
Muneem commented 7 years ago

yes that is nice suggestion crawler should check for path.Path variable was set but there were double quotes in path variable so it was not crawling.

I am closing this issue now as it was related to double quotes which was mistake on user end