Module: Cgmh_ks
- Defined in:
- lib/module/cgmh_ks.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 |
# File 'lib/module/cgmh_ks.rb', line 3 def Cgmh_ks.crawl hash = {} url = "https://www.cgmh.org.tw/bed/erd/index.asp?loc=8" begin page = Nokogiri::HTML(open(url)) hash[:hospital] = "cgmh_ks" hash[:to_119] = page.css("table:nth-child(1) tr:nth-child(5) td table tr:nth-child(3) td:nth-child(2) font").text.strip hash[:wait_see] = page.css("table:nth-child(1) tr:nth-child(5) td table tr:nth-child(4) td:nth-child(2) font").text.strip hash[:wait_push_bed] = page.css("table:nth-child(1) tr:nth-child(5) td table tr:nth-child(5) td:nth-child(2) font").text.strip hash[:wait_bed] = page.css("table:nth-child(1) tr:nth-child(5) td table tr:nth-child(6) td:nth-child(2) font").text.strip hash[:wait_cure_bed] = page.css("table:nth-child(1) tr:nth-child(5) td table tr:nth-child(7) td:nth-child(2) font").text.strip rescue Exception => e p e. return nil end return hash end |