module Kmuh

高雄醫學大學附設中和紀念醫院

Public Class Methods

crawl() click to toggle source
# File lib/module/kmuh.rb, line 3
def Kmuh.crawl
    hash = {}
    url = "http://www.kmuh.org.tw/KMUHWeb/Pages/P04MedService/ERStatus.aspx"
    begin
        page = Nokogiri::HTML(open(url))
        hash[:hospital] = "kmuh"
        hash[:to_119]        = page.css("#Label_A01").text.strip
        hash[:wait_see]      = page.css("#Label_A02").text.strip
        hash[:wait_push_bed] = page.css("#Label_A03").text.strip
        hash[:wait_bed]      = page.css("#Label_A04").text.strip
        hash[:wait_cure_bed] = page.css("#Label_A05").text.strip
    rescue Exception => e
        p e.message
        return nil
    end
    return hash
end