Sha256: dedfb471ff2da3a7832038d345a2f2b69df05c7512c58a474a7fe1a7c389473f
Contents?: true
Size: 567 Bytes
Versions: 14
Compression:
Stored size: 567 Bytes
Contents
#! /usr/bin/env ruby # == Synopsis # Crawls a site starting at the given URL, and outputs the total number # of unique pages on the site. # # == Usage # anemone_count.rb url # # == Author # Chris Kite $:.unshift File.join(File.dirname(__FILE__), "..", "lib") require 'anemone' def usage puts <<END Usage: anemone_count.rb url END end # make sure that the first option is a URL we can crawl begin URI(ARGV[0]) rescue usage Process.exit end Anemone.crawl(ARGV[0]) do |anemone| anemone.after_crawl do |pages| puts pages.uniq.size end end
Version data entries
14 entries across 14 versions & 4 rubygems