0

I have a simple ruby file that scraps a price off of walmart's site. I did a gem install scrapi and a gem install tidy. When I run my code on my windows 7 box I get the following error:

Error

c:/Ruby193/lib/ruby/gems/1.9.1/gems/scrapi-2.0.0/lib/scraper/reader.rb:216:in `r escue in parse_page': Scraper::Reader::HTMLParseError: didn't find tidy libs on your system. Please install tidy (http://tidy.sourceforge.net/) (Scraper::Reader ::HTMLParseError)

It appears that it can't find the tidy libraries, so I put it in my path:

Path=C:\Ruby193\lib\ruby\gems\1.9.1\gems\tidy_ffi-0.1.5\lib;C:\Ruby193\lib\ruby\gems\1.9.1\gems\tidy-1.1.2\lib

but it still throws the same can't find tidy libs error.

Thanks in advance for your help.

Code

require 'rubygems'
require 'scrapi'
require 'tidy'

scraper = Scraper.define do
process "div.firstRow div.priceAvail>div>div.PriceCompare>div.BodyS", :price => :text
result :price
end

url = URI.parse("http://www.walmart.com/search/search-ng.do?search_constraint=0&ic=48_0&search_query=LOST+third+season&Find.x=17&Find.y=1&Find=Find")
puts scraper.scrape(url)
rahrahruby
  • 673
  • 4
  • 11
  • 28

2 Answers2

0

I have exactly the same problem, but on Linux.

It is something to do with the find_tidy function in reader.rb - somehow it is not able find the libraries. I just went and commented that line, and it is working fine now.

      # Make sure the Tidy path is set and always apply the default
      # options (these only control things like errors, output type).
      # find_tidy
      options = (options || {}).update(TIDY_OPTIONS)

Try it if you are sure you have the tidy libraries in your system.

Sivaraj D
  • 1
  • 1
0

I had the same problem on a mac.

The offensive code is on line 204 of the reader.rb file. Open it in your favorite editor:

atom /usr/local/lib/ruby/gems/2.2.0/gems/scrapi-2.0.0/lib/scraper/reader.rb

Just comment it out like the previous answer said. Works great after that.

Danny
  • 3
  • 3