Module: Shh

Defined in:
lib/module/shh.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
20
21
# File 'lib/module/shh.rb', line 3

def Shh.crawl
    hash = {}
    url = "http://eng.shh.org.tw/ER_WEB/ER_WEB/"
    begin
        html = open(url).read
        html.encode!("big5")
        page = Nokogiri::HTML.parse html
        hash[:hospital] = "shh"
        hash[:to_119]        = page.css("#off").text.strip
        hash[:wait_see]      = page.css("#Label1").text.strip
        hash[:wait_push_bed] = page.css("#Label2").text.strip
        hash[:wait_bed]      = page.css("#Label3").text.strip
        hash[:wait_cure_bed] = page.css("#Label4").text.strip
    rescue Exception => e
        p e.message
        return nil
    end
    return hash
end