Craigler

Search API for craigslist

SYNOPSIS:

I couldn’t decide which API I liked best, so you have two choices.

Craigler.search(:motorcycles, :in => [:utah, :nevada, :arizona], :for => 'Boulevard M50') do |item|
  puts item.title
  puts item.url
  puts item.time
end

or

Craigler.find('Boulevard M50', :in => :california, :only => :motorcycles) do |item|
  puts item.title
  puts item.url
  puts item.time
end

You can also create a search object to fetch the results later. When no location or category is given Craigler searches :all_for_sale_or_wanted in :anywhere

search = Craigler::Search.new('Yamaha')
search.results(:page_limit => 1)

Note that additional calls to search.results() will always return the same result set unless refresh is forced

search.results(:refresh => true)

Supported Categories

:all_for_sale_or_wanted, :art_and_crafts, :auto_parts, :baby_and_kid_stuff, :barter, :bicycles, :boats, :books, :business, :cars_and_trucks, :clothing, :collectibles, :community, :computers_and_tech, :electronics, :event, :farm_and_garden, :free_stuff, :furniture, :games_and_toys, :garage_sales, :general, :gigs, :household, :housing, :items_wanted, :jewelry, :jobs, :materials, :media, :motorcycles, :musical_instruments, :personals, :photo_and_video, :recreational_vehicles, :resume, :services_offered, :sporting_goods, :tickets, :tools

Supported Locations

:alaska, :arizona, :arkansas, :california, :colorado, :connecticut, :delaware, :dc, :florida, :georgia, :hawaii, :idaho, :illinois, :indiana, :iowa, :kansas, :kentucky, :louisiana, :maine, :maryland, :mass, :michigan, :minnesota, :mississippi, :missouri, :montana, :nebraska, :nevada, :n_hampshire, :new_jersey, :new_mexico, :new_york, :n_carolina, :north_dakota, :ohio, :oklahoma, :oregon, :pennsylvania, :rhode_island, :s_carolina, :south_dakota, :tennessee, :texas, :utah, :vermont, :virginia, :washington, :west_virginia :wisconsin, :wyoming

Or use :anywhere to search all supported locations.

REQUIREMENTS:

  • Hpricot

INSTALL:

  • sudo gem install quixoten-craigler

Copyright © 2009 Devin Christensen. See LICENSE for details.