module Vghtc
臺中榮民總醫院
Public Class Methods
crawl()
click to toggle source
# File lib/module/vghtc.rb, line 3 def Vghtc.crawl hash = {} url = "http://www.vghtc.gov.tw/GipOpenWeb/wSite/sp?xdUrl=/wSite/query/Doctor/GetEmgBedInform.jsp&ctNode=55658&mp=1&idPath=213_55658" begin page = Nokogiri::HTML(open(url)) hash[:hospital] = "vghtc" hash[:to_119] = page.css("div.cp table tr:nth-child(2) td:nth-child(2) font b").text.strip hash[:wait_internal_medicine] = page.css("div.cp table tr:nth-child(4) td:nth-child(2) font b").text.gsub("人", "").strip hash[:wait_surgery] = page.css("div.cp table tr:nth-child(5) td:nth-child(2) font b").text.gsub("人", "").strip hash[:wait_paediatrics] = page.css("div.cp table tr:nth-child(6) td:nth-child(2) font b").text.gsub("人", "").strip hash[:wait_push_bed] = page.css("div.cp table tr:nth-child(8) td:nth-child(2) font b").text.gsub("人", "").strip hash[:wait_bed] = page.css("div.cp table tr:nth-child(10) td:nth-child(2) font b").text.gsub("人", "").strip hash[:wait_cure_bed] = page.css("div.cp table tr:nth-child(12) td:nth-child(2) font b").text.gsub("人", "").strip rescue Exception => e p e.message return nil end return hash end