module Scmh

秀傳醫療社團法人秀傳紀念醫院

Public Class Methods

crawl() click to toggle source
# File lib/module/scmh.rb, line 3
def Scmh.crawl
    hash = {}
    url = "http://www.scmh.org.tw/"
    begin
        html = open(url).read
        html.encode!("big5")
        page = Nokogiri::HTML.parse html
        hash[:hospital] = "scmh"
        # hash[:to_119]        = page.css("").text.strip
        hash[:wait_see]      = page.css("#aspnetForm table tr:nth-child(6) td table tr td.map table tr td:nth-child(1) table:nth-child(2) tr td div.TVtext table tr:nth-child(1) td:nth-child(2)").text.strip
        hash[:wait_push_bed] = page.css("#ctl00_ContentPlaceHolder1_ERTVView_min_LabelBN").text.strip
        hash[:wait_bed]      = page.css("#ctl00_ContentPlaceHolder1_ERTVView_min_LabelHN").text.strip
        hash[:wait_cure_bed] = page.css("#ctl00_ContentPlaceHolder1_ERTVView_min_LabelICN").text.strip
    rescue Exception => e
        p e.message
        return nil
    end
    return hash
end