Code Monkey home page Code Monkey logo

Comments (3)

mna avatar mna commented on June 26, 2024

Hello James,

I understand the issue, but this is working as intended, as the robots.txt spec explicitly mentions that:

The directives listed in the robots.txt file apply only to the host, protocol and port number where the file is hosted.
Ex: http://example.com/robots.txt
Valid for: http://example.com/, http://example.com/folder/file
Not valid for: http://other.example.com/, https://example.com/

In fact, if anything the scheme should be added to the key of f.hosts to better comply with the spec.

So they effectively are distinct hosts and should be treated as such, each with their own independent crawl delays. In your case, I'd suggest controlling the queuing by storing the links in a DB and feeding them at a controlled rate into fetcher (maybe with a semaphore using a channel)? Unless you call Cancel on the queue, (in which case you explicitly opt out of processing any pending queued URL) all queued URLs are guaranteed to generate a call to the Handler, so you can acquire a semaphore slot on Send and release it in the Handler.

Hope this helps,
Martin

from fetchbot.

james-relyea avatar james-relyea commented on June 26, 2024

Ahh, okay. Makes sense. I wasn't looking at the CrawlDelay from a robots.txt perspective. I suppose I'm looking for an IP-centric crawling delay rather than one based on host/robots.txt. I'll seek an alternative solution, thanks for the info + quick response!

from fetchbot.

mna avatar mna commented on June 26, 2024

You could use net.LookupIP function to resolve the host first, and enqueue urls using http[s]:///path, but presumably they use virtual hosts based on the subdomain, so that's unlikely to solve your problem.

from fetchbot.

Related Issues (17)

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.