module Tzuchi_hl

佛教慈濟醫療財團法人花蓮慈濟醫院

Public Class Methods

crawl() click to toggle source
# File lib/module/tzuchi_hl.rb, line 4
def Tzuchi_hl.crawl
    hash = {}
    url = "http://hlm.tzuchi.com.tw/html/hlinfos.html"
    begin
        page = Nokogiri::HTML(open(url))
        hash[:hospital] = "tzuchi_hl"
        hash[:to_119]        = page.css("body > table tr:nth-child(5) td:nth-child(2)").text.strip
        hash[:wait_see]      = page.css("body > table tr:nth-child(6) td:nth-child(2)").text.strip
        hash[:wait_push_bed] = page.css("body > table tr:nth-child(7) td:nth-child(2)").text.strip
        hash[:wait_bed]      = page.css("body > table tr:nth-child(8) td:nth-child(2)").text.strip
        hash[:wait_cure_bed] = page.css("body > table tr:nth-child(9) td:nth-child(2)").text.strip
    rescue Exception => e
        p e.message
        return nil
    end
    return hash
end