Skip to content

Instantly share code, notes, and snippets.

@kylessnell
Created October 30, 2012 02:57
Show Gist options
  • Save kylessnell/3978051 to your computer and use it in GitHub Desktop.
Save kylessnell/3978051 to your computer and use it in GitHub Desktop.
#Fakeweb
cl_url = 'http://sfbay.craigslist.org/search/sssquery=1999+toyota+tundra&srchType=A&minAsk=500&maxAsk=9000&hasPic=1'
FakeWeb.register_uri(:get, "#{cl_url}", :response => "response_from_cl_search.html")
#Nokogiri
#get entire page as Nokogiri object
def parse_results(url)
returned_page = Nokogiri::HTML(open(url))
end
#get item listed date
def parse_listed_dates(nokogiri_object)
temp_array = []
return_val = nokogiri_object.css('p.row span.itemdate').each {|i| temp_array << i.children.text}
temp_array
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment