Module: Csh
- Defined in:
- lib/module/csh.rb
Overview
中山醫學大學附設醫院
Class Method Summary collapse
Class Method Details
.crawl ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/module/csh.rb', line 3 def Csh.crawl hash = {} url = "http://www.csh.org.tw/ER/index.aspx" begin html = open(url).read html.encode!("big5") page = Nokogiri::HTML.parse html hash[:hospital] = "csh" hash[:wait_see] = page.css("#WaitVisitCount").text.strip hash[:wait_push_bed] = page.css("#WaitErBedCount").text.strip hash[:wait_bed] = page.css("#WaitInpBedCount").text.strip hash[:wait_cure_bed] = page.css("#WaitInpBedCount").text.strip hash[:wait_internal_medicine] = page.css("#WaitBedInME").text.strip hash[:wait_surgery] = page.css("#WaitBedInSE").text.strip hash[:wait_paediatrics] = page.css("#WaitBedInPE").text.strip hash[:wait_gynaecology] = page.css("#WaitBedInGE").text.strip hash[:wait_other] = page.css("#WaitBedOthers").text.strip hash[:to_119] = page.css("#ReportStatus").text.strip rescue Exception => e p e. return nil end return hash end |