Giter VIP home page Giter VIP logo

Comments (7)

jodizzle avatar jodizzle commented on May 20, 2024 1

That sounds pretty reasonable. I'll take a look.

from colly.

asciimoo avatar asciimoo commented on May 20, 2024

@jodizzle this would be a handy addition. Do you want to work on it?

As a workaround you can add an OnRequest callback with random sleeps:

c.OnRequest(func(_ *colly.Request) {
    time.Sleep(time.Duration(rand.Randint(5)+1) * time.Second)
})

from colly.

jodizzle avatar jodizzle commented on May 20, 2024

@asciimoo Ah, I hadn't thought of the OnRequest approach. Thanks.

And sure, I can try working on it. Do you have any thoughts about what the best implementation would be?

from colly.

asciimoo avatar asciimoo commented on May 20, 2024

I like the idea of extending LimitRule with a RandomDelay time.Duration attribute which is 0 by default. If its value isn't 0, a random duration between 0 and RandomDelay could be added to LimitRule.Delay on every request. This solution doesn't break the current API and it's intuitive for me. What do you think?

from colly.

jlr52 avatar jlr52 commented on May 20, 2024

Not sure if its okay, but I got interested in the code base so I just implemented the enhancement.

@jodizzle let me know if you still want to fix it and I can decline my pull request.

#67

from colly.

jodizzle avatar jodizzle commented on May 20, 2024

@jlr52 Fine by me -- I was being slow. Your approach seems similar to what I was thinking anyway. I'll take a closer look.

from colly.

asciimoo avatar asciimoo commented on May 20, 2024

implemented in #67 - thanks @jlr52

from colly.

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.