All pastes #801656 Raw Edit

Someone

public text v1 · immutable
#801656 ·published 2007-11-29 14:07 UTC
rendered paste body

require 'rubygems'
require 'scrubyt'

Scrubyt.logger = Scrubyt::Logger.new
ebay_data = Scrubyt::Extractor.define do

  fetch 'http://www.ebay.com/'
  fill_textfield 'satitle', 'ipod video 80gb'
  submit

  record_table "//table[@class='ebItemlist single']" do
    record "//tr[6]" do
      item_name "/td[@class='ebcTtl']", :write_text => true do
        item_link "//a" do
          url_detail do
            detail_link 'See detailed feedback', :generalize => false do
              item_detail do
                record "//tr[@class='fbsBigLabel'][2]" do
                  feedback :ends_with => "%"
                  
                  #extract positive feedbacks for testing(and when we complete this task, we search for neutral and negatives
                  #seem not working:
                  
                  	neu do
                  		neutral "/tr/td[2]"
                  		end.ensure_presence_of_ancestor_node(:tr, 'alt' => 'Positive feedback rating')
        
                  
                end
              end
            end
            #give me the content of the first <tr></tr>, which contains the text "Seller:"
			seller_row "tr[Seller:]", :type => :text do
			#go to the second <td> and give me the content of the first <a></a> you find
    		seller "/td[2]/a[1]"
    		end
          end
        end
      end
         price "/td[@class='ebcPr']"
       bids "/td[@class='ebcBid']"
    end
  end
end

puts ebay_data.to_flat_xml