Module: Ncku

Defined in:
lib/module/ncku.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/ncku.rb', line 3

def Ncku.crawl
    hash = {}
    url = "http://www.hosp.ncku.edu.tw/nckm/ER/default.aspx"
    begin
        html = open(url).read
        html.encode!("big5")
        page = Nokogiri::HTML.parse html
        hash[:hospital] = "ncku"
        hash[:to_119]        = page.css("#lbBulletin").text.strip
        hash[:wait_see]      = page.css("#lbSee").text.strip
        hash[:wait_push_bed] = page.css("#lbBed").text.strip
        hash[:wait_bed]      = page.css("#lbIn").text.strip
        hash[:wait_cure_bed] = page.css("#lbICU").text.strip
    rescue Exception => e
        p e.message
        return nil
    end
    return hash
end