Module: Tzuchi_hl

Defined in:
lib/module/tzuchi_hl.rb

Overview

佛教慈濟醫療財團法人花蓮慈濟醫院

Class Method Summary collapse

Class Method Details

.crawlObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/module/tzuchi_hl.rb', line 4

def Tzuchi_hl.crawl
    hash = {}
    url = "http://hlm.tzuchi.com.tw/html/hlinfos.html"
    begin
        page = Nokogiri::HTML(open(url))
        hash[:hospital] = "tzuchi_hl"
        hash[:to_119]        = page.css("body > table tr:nth-child(5) td:nth-child(2)").text.strip
        hash[:wait_see]      = page.css("body > table tr:nth-child(6) td:nth-child(2)").text.strip
        hash[:wait_push_bed] = page.css("body > table tr:nth-child(7) td:nth-child(2)").text.strip
        hash[:wait_bed]      = page.css("body > table tr:nth-child(8) td:nth-child(2)").text.strip
        hash[:wait_cure_bed] = page.css("body > table tr:nth-child(9) td:nth-child(2)").text.strip
    rescue Exception => e
        p e.message
        return nil
    end
    return hash
end