Hi,
I get errors at a lot of places when trying to retrieve ticker symbols for US companies from http://d.yimg.com/autoc.finance.yahoo.com/autoc?callback=YAHOO.Finance.SymbolSuggest.ssCallback&query=Wal-Mart
I have tried to:
resp = Net::HTTP.get_response(URI.parse(url))
data = resp.body
qwe = data.split("symbol")
p qwe[1]
arr1 = data.split("(")
arr2 = arr1[1].split(")")
fnl = arr2[0].gsub(/-/, '')
fnl = fnl.gsub(/\(/, '')
fnl = fnl.gsub(/\)/, '')
fnl = fnl.gsub(/\./, '')
fnl = fnl.gsub('\'', '"')
fnl = fnl.gsub(/([\{|\,}])\s*([a-zA-Z]+):/, '\1 "\2":')
But this doesnt help as i see:
/Library/Ruby/Gems/1.8/gems/json-1.2.0/lib/json/common.rb:123:in `parse': 353: unexpected token at '{"symbol":"BEEV","name": "BENCHMARK ENERGY CORP ' (JSON::ParserError)
Any clues as to what i might be doing wrong?