Comments (3)
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.
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.
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)
- limit the depth HOT 3
- Drain queue HOT 8
- Handler and Matcher Design HOT 1
- The ability to use multiple goroutines per host HOT 1
- Fail queue object in handler HOT 4
- Expose queue size HOT 3
- Getting lots of i/o timeouts HOT 2
- Cancel() make goroutine leak HOT 1
- Need help to identify the issue in the implementation. HOT 3
- Add a random delay between each cmd? HOT 3
- Parallellize queue HOT 5
- HeaderProvider example HOT 1
- robotstxt-go has renamed to robotstxt HOT 1
- Mux does not prioritize most specific matching Handler
- Update package to use go.mod
- q.Block even if seed empty HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fetchbot.