Skip to content

Commit

Permalink
Update scraper.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
rjtedge committed Aug 30, 2017
1 parent e911851 commit 18f3209
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions scraper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
baths = page2.at('.listing-features.alt > span:nth-child(2) > span.copy > em').inner_text.strip
cars = page2.at('.listing-features.alt > span:nth-child(3) > span.copy > em').inner_text.strip
agents = page2.at('#propertyStoryPartial > div > div > div').text.strip.partition('For more information on this property, contact ').last
pricetest = page2.at('#main > div > header > div > div.left-wrap > span').inner_text.strip.to_s
pricetest = page2.at('#main > div > header > div > div.left-wrap > span').inner_text.strip.to_s.gsub('K','000')
low = ''
high = ''
lat = @lats[i]
Expand All @@ -38,8 +38,11 @@
if price.include? "-"
low = price.partition('-').first
high = price.partition('-').last
elsif price.include? "to"
low = price.partition('to').first
high = price.partition('to').last
else
high = price
high = price.gsub(/\D/, '')
end
elsif page2.at('div:nth-child(1) > p.statement-of-information__data-point-value')
low = page2.at('div:nth-child(1) > p.statement-of-information__data-point-value').inner_text.strip.delete! '$ ,'
Expand Down Expand Up @@ -87,7 +90,7 @@
baths = page2.at('.listing-features.alt > span:nth-child(2) > span.copy > em').inner_text.strip
cars = page2.at('.listing-features.alt > span:nth-child(3) > span.copy > em').inner_text.strip
agents = page2.at('#propertyStoryPartial > div > div > div').text.strip.partition('For more information on this property, contact ').last
pricetest = page2.at('#main > div > header > div > div.left-wrap > span').inner_text.strip.to_s
pricetest = page2.at('#main > div > header > div > div.left-wrap > span').inner_text.strip.to_s.gsub('K','000')
low = ''
high = ''
lat = @lats[i]
Expand All @@ -97,8 +100,11 @@
if price.include? "-"
low = price.partition('-').first
high = price.partition('-').last
elsif price.include? "to"
low = price.partition('to').first
high = price.partition('to').last
else
high = price
high = price.gsub(/\D/, '')
end
elsif page2.at('div:nth-child(1) > p.statement-of-information__data-point-value')
low = page2.at('div:nth-child(1) > p.statement-of-information__data-point-value').inner_text.strip.delete! '$ ,'
Expand Down

0 comments on commit 18f3209

Please sign in to comment.