Module: Cch

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

def Cch.crawl
    begin
        hash = {}
        url = "http://www.cch.org.tw/news/er_news.aspx"
        page = Nokogiri::HTML(open(url))
        hash[:hospital] = "cch"
        hash[:to_119]        = page.css("#Image2").map {|i| i['alt']}[0]
        hash[:wait_see]      = page.css("#Txt_Label2").text.strip
        hash[:wait_push_bed] = page.css("#Txt_Label3").text.strip
        hash[:wait_bed]      = page.css("#Txt_Label4").text.strip
        hash[:wait_cure_bed] = page.css("#Txt_Label5").text.strip
    rescue Exception => e
        p e.message
        return nil
    end
    return hash
end