Module: Pohai
- Defined in:
- lib/module/pohai.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/pohai.rb', line 3 def Pohai.crawl hash = {} url = "http://www.pohai.org.tw/pohai/bedqty_er/bedqty_er.php" begin page = Nokogiri::HTML(open(url)) hash[:hospital] = "pohai" hash[:to_119] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(1)").text.strip hash[:wait_see] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(2)").text.gsub("人", "").strip hash[:wait_push_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(3)").text.gsub("人", "").strip hash[:wait_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(4)").text.gsub("人", "").strip hash[:wait_cure_bed] = page.css("table tr:nth-child(2) td table tr:nth-child(2) td:nth-child(5)").text.gsub("人", "").strip rescue Exception => e p e. return nil end return hash end |