U-Haul

A Ruby library offering both a CLI and API for scraping U-Haul self-storage facilities and prices.

Installation

gem install uhaul

Configuration

require 'uhaul'

UHaul.configure do |config|
  config.user_agent = '../..' # ENV['UHAUL_USER_AGENT']
  config.timeout = 30 # ENV['UHAUL_TIMEOUT']
  config.proxy_url = 'http://user:pass@superproxy.zenrows.com:1337' # ENV['UHAUL_PROXY_URL']
end

Usage

require 'uhaul'

sitemap = UHaul::Facility.sitemap
sitemap.links.each do |link|
  url = link.loc
  facility = UHaul::Facility.fetch(url:)

  puts facility.text

  facility.prices.each do |price|
    puts price.text
  end

  puts
end

CLI

uhaul crawl
uhaul crawl "https://www.uhaul.com/Locations/Self-Storage-near-Manchester-Township-NJ-08759/925037/"