Rcrawl is a web crawler written entirely in ruby. It's limited right now by the fact that it will stay on the original domain provided.
Rcrawl is available as a gem here: https://rubygems.org/gems/rcrawl/versions/0.5.1
Rcrawl uses a modular approach to processing the HTML it receives. The link exraction portion of Rcrawl depends on the scrAPI toolkit by Assaf Arkin (http://labnotes.org). gem install scrapi
The structure of the crawling process was inspired by the specs of the Mercator crawler (http://www.cindoc.csic.es/cybermetrics/pdf/68.pdf). A (somewhat) brief overview of the design philosophy follows.
- Remove an absolute URL from the URL Server.
- Download corresponding document from the internet, grabbing and processing robots.txt first, if available.
- Feed the document into a rewind input stream(ris) to be read/re-read as needed. Based on MIME type, invoke the process method of the
- processing module associated with that MIME type. For example, a link extractor or tag counter module for text/html MIME types, or a gif stats module for image/gif. By default, all text/html MIME types will pass through the link extractor. Each link will be converted to an absolute URL and tested against a (ideally user-supplied) URL filter to determine if it should be downloaded.
- If the URL passes the filter (currently hard coded as Same Domain?), then call the URL-seen? test.
- Has the URL been seen before? Namely, is it in the URL Server or has it been downloaded already? If the URL is new, it is added to the URL Server.
- Back to step 1, repeat until the URL Server is empty.
`crawler = Rcrawl::Crawler.new(url)`
`crawler.crawl`
`crawler.visited_links`
`crawler.raw_html`
`crawler.errors`
`crawler.external_links`
`crawler.user_agent = "Your fancy crawler name here"`
Copyright © 2006 Digital Duckies, LLC, under MIT License
Developed for Digital Duckies by Shawn Hansen and Jason Burgett