Module: Ktgh_dajia
- Defined in:
- lib/module/ktgh_dajia.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_dajia.rb', line 3 def Ktgh_dajia.crawl hash = {} url = "http://www.ktgh.com.tw/BednoInfo_Show.asp?CatID=81&ModuleType=Y" begin html = open(url).read html.encode!("big5") page = Nokogiri::HTML.parse html hash[:hospital] = "ktgh_dajia" # 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 |