Module: Tzuchi

Defined in:
lib/module/tzuchi.rb

Overview

佛教慈濟醫療財團法人台北慈濟醫院

Class Method Summary collapse

Class Method Details

.crawlObject



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

def Tzuchi.crawl
    hash = {}
    url = "http://www.pohai.org.tw/pohai/bedqty_er/bedqty_er.php"
    begin
        page = Nokogiri::HTML(open(url))
        hash[:hospital] = "tzuchi"
        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.message
        return nil
    end
    return hash
end