3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/module/edah.rb', line 3
def Edah.crawl
hash = {}
url = "http://www3.edah.org.tw/E-DA/WebRegister/ProcessEmeInf.jsp"
begin
html = open(url).read
html.encode!("big5")
page = Nokogiri::HTML.parse html
hash[:hospital] = "edah"
hash[:to_119] = self.split(page.css("body table tr:nth-child(1) td font").text.strip)
hash[:wait_see] = self.split(page.css("body table tr:nth-child(2) td font").text.strip)
hash[:wait_push_bed] = self.split(page.css("body table tr:nth-child(3) td font").text.strip)
hash[:wait_bed] = self.split(page.css("body table tr:nth-child(4) td font").text.strip)
hash[:wait_cure_bed] = self.split(page.css("body table tr:nth-child(5) td font").text.strip)
rescue Exception => e
p e.message
return nil
end
return hash
end
|