Sha256: 35701c1a8b2720a5d64de875e85c0d1858f1402f1e24bd9cb70be1f50a4d26d8
Contents?: true
Size: 950 Bytes
Versions: 2
Compression:
Stored size: 950 Bytes
Contents
require 'rubygems' require 'rfuzz/browser' include RFuzz require 'pstore' if ARGV.length < 4 puts "usage: ruby cl_watcher.rb city cat areaID \"search\"" exit 1 end city, cat, areaID, search = ARGV.shift, ARGV.shift, ARGV.shift, ARGV href_seen = PStore.new("watcher_seen_links.pstore") web = Browser.new("#{city}.craigslist.org") loop do puts "Checking..." search.each do |query| puts "SEARCH: #{query}" web.start("/cgi-bin/search", :query => {"areaID" => areaID, "subAreaID" => "0","query" => query, "catAbbreviation" => cat, "minAsk" => "min", "maxAsk" => "max"}) href_seen.transaction do web.links(/[0-9]*.html/).each do |link| href = link.attributes["href"] if !href_seen[href] puts href puts " -- " + link.children.join `firefox '#{href}'` href_seen[href] = link end end end end puts "----\nSleeping..." sleep 60 * (rand(10)+3) end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rfuzz-0.8 | examples/cl_watcher.rb |
rfuzz-0.9 | examples/cl_watcher.rb |