瀏覽代碼

Allow local scraper to read from local file

master
Adrian Short 7 年之前
父節點
當前提交
e15acd1b07
共有 1 個檔案被更改,包括 8 行新增4 行删除
  1. +8
    -4
      scraper.rb

+ 8
- 4
scraper.rb 查看文件

@@ -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…
取消
儲存