Module: Ktgh_shalu
- Defined in:
- lib/module/ktgh_shalu.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 |
# File 'lib/module/ktgh_shalu.rb', line 3 def Ktgh_shalu.crawl hash = {} url = "http://www.ktgh.com.tw/BednoInfo_Show.asp?CatID=80&ModuleType=Y" begin html = open(url).read html.encode!("big5") page = Nokogiri::HTML.parse html hash[:hospital] = "ktgh_shalu" # hash[:to_119] = page.css("#off").text.strip hash[:wait_see] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(2)").text.strip hash[:wait_push_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(3)").text.strip hash[:wait_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(4)").text.strip hash[:wait_cure_bed] = page.css("#Table3 > tr:nth-child(2) > td > table:nth-child(2) tr:nth-child(2) td:nth-child(5)").text.strip rescue Exception => e p e. return nil end return hash end |