module Ntuh_taipei
國立臺灣大學醫學院附設醫院
Public Class Methods
crawl()
click to toggle source
# File lib/module/ntuh_taipei.rb, line 3 def Ntuh_taipei.crawl hash = {} url = "https://reg.ntuh.gov.tw/EmgInfoBoard/NTUHEmgInfo.aspx" begin html = open(url).read html.encode!("big5") page = Nokogiri::HTML.parse html hash[:hospital] = "ntuh_taipei" hash[:wait_register] = page.css("#form1 table tr:nth-child(1) td:nth-child(2)").text.gsub("人", "").strip hash[:wait_see] = page.css("#form1 table tr:nth-child(2) td:nth-child(2)").text.gsub("人", "").strip hash[:wait_bed] = page.css("#form1 table tr:nth-child(3) td:nth-child(2)").text.gsub("人", "").strip hash[:wait_icu ] = page.css("#form1 table tr:nth-child(4) td:nth-child(2)").text.gsub("人", "").strip hash[:wait_push_bed] = page.css("#form1 table tr:nth-child(5) td:nth-child(2)").text.gsub("人", "").strip rescue Exception => e p e.message return nil end return hash end