2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# 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
|