module Ndmctsgh
Public Class Methods
crawl()
click to toggle source
# File lib/module/ndmctsgh.rb, line 2 def Ndmctsgh.crawl hash = {} url = "http://www1.ndmctsgh.edu.tw/ErOnlineNews/ErOnLineData.aspx" begin html = open(url).read html.encode!("big5") page = Nokogiri::HTML.parse html hash[:hospital] = "ndmctsgh" hash[:to_119] = page.css("#Label7").text.strip hash[:wait_see] = page.css("#Label8").text.strip hash[:wait_push_bed] = page.css("#Label9").text.strip hash[:wait_bed] = page.css("#Label10").text.strip hash[:wait_cure_bed] = page.css("#Label11").text.strip rescue Exception => e p e.message return nil end return hash end