module Cch

彰化基督教醫療財團法人彰化基督教醫院

Public Class Methods

crawl() click to toggle source
# 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