I put together this script based on this tutorial.
require 'nokogiri'
require 'open-uri'
url = "http://sfbay.craigslist.org/sby/jjj/"
data = Nokogiri::HTML(open(url))
puts data.at_css('.itempn').text
puts data.at_css('.itemcg').text
I keep getting this error:
Macintosh:nokogiri rgrush$ ruby aaa.rb
aaa.rb:1: syntax error, unexpected tIDENTIFIER, expecting $end
url = "http://sf...
^
Any ideas? Could it be that one of my dependencies is out of date?
most likely you have a non ASCII char in URL.
try adding
as first line of
aaa.rbso it will look like: