Browse Source

Allow local scraper to read from local file

master
Adrian Short 7 years ago
parent
commit
e15acd1b07
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      scraper.rb

+ 8
- 4
scraper.rb View File

@@ -73,10 +73,14 @@ d = Date.today
d_start = (d - 29).strftime("%d/%m/%Y")
d_end = d.strftime("%d/%m/%Y")
url = "#{BASEURL}Summary?weekListType=SRCH&recFrom=#{d_start}&recTo=#{d_end}&ward=ALL&appTyp=ALL&wardTxt=All%20Wards&appTypTxt=All%20Application%20Types&limit=500"
puts url

page = agent.get(url)
if ENV['SCRAPER_LOCAL']
page = Nokogiri::HTML(open("page.html"))
else
url = "#{BASEURL}Summary?weekListType=SRCH&recFrom=#{d_start}&recTo=#{d_end}&ward=ALL&appTyp=ALL&wardTxt=All%20Wards&appTypTxt=All%20Application%20Types&limit=500"
page = agent.get(url)
puts url
end
apps = page.search("#planningApplication")
puts apps.size, ''


Loading…
Cancel
Save