Git Product home page Git Product logo

Comments (9)

Jellyfrog avatar Jellyfrog commented on May 21, 2024

Use the git-version:

  1. npm uninstall crawler
  2. download from here
  3. npm install /path/to/crawler/

from node-crawler.

naonak avatar naonak commented on May 21, 2024

Thanks for you answer.

After apply what you says, I got this error :

/home/fabien/Projets/crawler_nodejs/node_modules/crawler/lib/crawler.js:178
response.uri = q.uri;
^
TypeError: Cannot set property 'uri' of undefined
at [object Object].callback (/home/fabien/Projets/crawler_nodejs/node_modules/crawler/lib/crawler.js:178:38)
at [object Object]. (/home/fabien/Projets/crawler_nodejs/node_modules/crawler/node_modules/request/main.js:150:67)
at [object Object].emit (events.js:64:17)
at Object._onTimeout (/home/fabien/Projets/crawler_nodejs/node_modules/crawler/node_modules/request/main.js:304:19)
at Timer.callback (timers.js:83:39)

from node-crawler.

naonak avatar naonak commented on May 21, 2024

To show why, I try this at crawler.js:178
request(q, function(error,response,body) {
console.log(error);
console.log(response);
response.uri = q.uri;
onContent(error,response,body,false);
});

Error : "ETIMEDOUT"
Response : undefined

I try with others domains but I got same errors

from node-crawler.

naonak avatar naonak commented on May 21, 2024

Ok, I find.

In you exemple, you ser 'timeout' to 60. But it's millisecond so got timeout.

Work well with :

var c = new Crawler({
"maxConnections":10,
"timeout":60*1000, // seconds
"debug":false,
"callback":function(error,result,$) {
console.log("Got page");
$("a").each(function(i,a) {
console.log(a.href);
//c.queue(a.href);
})
}
});

from node-crawler.

Jellyfrog avatar Jellyfrog commented on May 21, 2024

This works fine for me with git version of crawler:

var Crawler = require("crawler").Crawler,
    c = new Crawler({
        "maxConnections":10,
        "callback":function(error,result,$) {
            console.log("Got page");
            $("a").each(function(i,a) {
                console.log(a.href);
            })
        }
    });

c.queue(["http://www.google.com"]);

from node-crawler.

naonak avatar naonak commented on May 21, 2024

Last think : thanks very much for your work, it's awesome !

from node-crawler.

naonak avatar naonak commented on May 21, 2024

Improvement : if domain doesn't exists, response is undefined and got fatal error.
So it should be great to add condition at crawler.js:178

                request(q, function(error,response,body) {
                    if (response) {
                        response.uri = q.uri;
                    }
                    onContent(error,response,body,false);
                });

from node-crawler.

Jellyfrog avatar Jellyfrog commented on May 21, 2024

Hi, I didn't made this, say thanks to the guys at Joshfire :)
Please close this issue if it's solved!

from node-crawler.

naonak avatar naonak commented on May 21, 2024

@Jellyfrog : about your try, add timeout: 60 as in simple.js and you got an error too

from node-crawler.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.